diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/session/SessionManager.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/session/SessionManager.java index 6ee9324d019..497287cda6f 100644 --- a/server/tserver/src/main/java/org/apache/accumulo/tserver/session/SessionManager.java +++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/session/SessionManager.java @@ -462,24 +462,15 @@ public List getActiveScans() { List.of(sessions.entrySet(), copiedIdleSessions).forEach(s -> s.forEach(entry -> { Session session = entry.getValue(); - if (session instanceof SingleScanSession) { - final SingleScanSession ss = (SingleScanSession) session; - final KeyExtent extent = ss.extent; - final ScanType scanType = ScanType.SINGLE; - final ScanParameters params = ss.scanParams; - final ScanState state = computeScanState(ss.getScanTask()); - final long scanId = entry.getKey(); - - addActiveScan(activeScans, ss, extent, ct, scanType, state, params, scanId); - } else if (session instanceof MultiScanSession) { - final MultiScanSession mss = (MultiScanSession) session; - final KeyExtent extent = mss.threadPoolExtent; - final ScanType scanType = ScanType.BATCH; - final ScanParameters params = mss.scanParams; - final ScanState state = computeScanState(mss.getScanTask()); - final long scanId = entry.getKey(); - - addActiveScan(activeScans, mss, extent, ct, scanType, state, params, scanId); + if (session instanceof ScanSession) { + ScanSession scanSession = (ScanSession) session; + boolean isSingle = session instanceof SingleScanSession; + + addActiveScan(activeScans, scanSession, + isSingle ? ((SingleScanSession) scanSession).extent + : ((MultiScanSession) scanSession).threadPoolExtent, + ct, isSingle ? ScanType.SINGLE : ScanType.BATCH, + computeScanState(scanSession.getScanTask()), scanSession.scanParams, entry.getKey()); } }));