Skip to content

Commit

Permalink
simplified SessionManager.getActiveScans() further
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinrr888 committed Sep 11, 2024
1 parent 32c1db8 commit f1b4bac
Showing 1 changed file with 9 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -462,24 +462,15 @@ public List<ActiveScan> 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());
}
}));

Expand Down

0 comments on commit f1b4bac

Please sign in to comment.