@Test public void testDetectorLastUsedTimeSync_emptyQueue() { managerUnderTest.detectorLastUsedTimeSync(System.currentTimeMillis() + 1000 * 60); verify(detectorSource, never()).updatedDetectorLastUsed(any(UUID.class)); }
void detectorLastUsedTimeSync(long currentTime) { long updateDurationInSeconds = (currentTime - detectorsLastUsedSyncedTillTime) / 1000; if (updateDurationInSeconds <= 0 || detectorsLastUsedTimeToBeUpdatedQueue.isEmpty()) { return; } processDetectorsLastTimeUsedQueue(); detectorsLastUsedSyncedTillTime = currentTime; }
DetectorManager { void detectorLastUsedTimeSync(long currentTime) { long updateDurationInSeconds = (currentTime - detectorsLastUsedSyncedTillTime) / 1000; if (updateDurationInSeconds <= 0 || detectorsLastUsedTimeToBeUpdatedQueue.isEmpty()) { return; } processDetectorsLastTimeUsedQueue(); detectorsLastUsedSyncedTillTime = currentTime; } }
DetectorManager { void detectorLastUsedTimeSync(long currentTime) { long updateDurationInSeconds = (currentTime - detectorsLastUsedSyncedTillTime) / 1000; if (updateDurationInSeconds <= 0 || detectorsLastUsedTimeToBeUpdatedQueue.isEmpty()) { return; } processDetectorsLastTimeUsedQueue(); detectorsLastUsedSyncedTillTime = currentTime; } DetectorManager(DetectorSource detectorSource,
                           DataInitializer dataInitializer,
                           Config config,
                           Map<UUID, DetectorContainer> cachedDetectors,
                           MetricRegistry metricRegistry);  DetectorManager(DetectorSource detectorSource,
                           DataInitializer dataInitializer,
                           Config config,
                           MetricRegistry metricRegistry); }
DetectorManager { void detectorLastUsedTimeSync(long currentTime) { long updateDurationInSeconds = (currentTime - detectorsLastUsedSyncedTillTime) / 1000; if (updateDurationInSeconds <= 0 || detectorsLastUsedTimeToBeUpdatedQueue.isEmpty()) { return; } processDetectorsLastTimeUsedQueue(); detectorsLastUsedSyncedTillTime = currentTime; } DetectorManager(DetectorSource detectorSource,
                           DataInitializer dataInitializer,
                           Config config,
                           Map<UUID, DetectorContainer> cachedDetectors,
                           MetricRegistry metricRegistry);  DetectorManager(DetectorSource detectorSource,
                           DataInitializer dataInitializer,
                           Config config,
                           MetricRegistry metricRegistry); DetectorResult detect(@NonNull MappedMetricData mappedMetricData); Meter getDetectorAndLevelMeter(String name, AnomalyLevel anomalyLevel); }
DetectorManager { void detectorLastUsedTimeSync(long currentTime) { long updateDurationInSeconds = (currentTime - detectorsLastUsedSyncedTillTime) / 1000; if (updateDurationInSeconds <= 0 || detectorsLastUsedTimeToBeUpdatedQueue.isEmpty()) { return; } processDetectorsLastTimeUsedQueue(); detectorsLastUsedSyncedTillTime = currentTime; } DetectorManager(DetectorSource detectorSource,
                           DataInitializer dataInitializer,
                           Config config,
                           Map<UUID, DetectorContainer> cachedDetectors,
                           MetricRegistry metricRegistry);  DetectorManager(DetectorSource detectorSource,
                           DataInitializer dataInitializer,
                           Config config,
                           MetricRegistry metricRegistry); DetectorResult detect(@NonNull MappedMetricData mappedMetricData); Meter getDetectorAndLevelMeter(String name, AnomalyLevel anomalyLevel);  }