@Test public void shouldRescheduleReaperOnFailure() throws ExecutionException, InterruptedException { ScheduledFuture explodingFuture = mock(ScheduledFuture.class); given(explodingFuture.get()).willThrow(mock(ExecutionException.class)); given(scheduledService.scheduleAtFixedRate(any(Runnable.class), anyLong(), anyLong(), any(TimeUnit.class))) .willReturn(explodingFuture); given(mockMonitor.isShutdown()).willReturn(false).willReturn(false).willReturn(false).willReturn(false).willReturn(true); watchDog.startReaper(); verify(scheduledService, times(2)).scheduleAtFixedRate(any(Runnable.class), anyLong(), anyLong(), any(TimeUnit.class)); }
public void startReaper() { if (monitor.isShutdown()) { log("Not scheduling the Watch Dog, shutdown in progress."); return; } log("Scheduling the CTS Reaper every " + config.getRunPeriod() + "ms"); workerPool.submit(new WatchDog()); }
CTSReaperWatchDog { public void startReaper() { if (monitor.isShutdown()) { log("Not scheduling the Watch Dog, shutdown in progress."); return; } log("Scheduling the CTS Reaper every " + config.getRunPeriod() + "ms"); workerPool.submit(new WatchDog()); } }
CTSReaperWatchDog { public void startReaper() { if (monitor.isShutdown()) { log("Not scheduling the Watch Dog, shutdown in progress."); return; } log("Scheduling the CTS Reaper every " + config.getRunPeriod() + "ms"); workerPool.submit(new WatchDog()); } @Inject  CTSReaperWatchDog(CTSReaper reaper, CoreTokenConfig config,
                             ReaperShutdownMonitor monitor,
                             @Named(CoreTokenConstants.CTS_SCHEDULED_SERVICE) ScheduledExecutorService scheduledService,
                             @Named(CoreTokenConstants.CTS_WORKER_POOL) ExecutorService workerPool,
                             @Named(CoreTokenConstants.CTS_REAPER_DEBUG) Debug debug); }
CTSReaperWatchDog { public void startReaper() { if (monitor.isShutdown()) { log("Not scheduling the Watch Dog, shutdown in progress."); return; } log("Scheduling the CTS Reaper every " + config.getRunPeriod() + "ms"); workerPool.submit(new WatchDog()); } @Inject  CTSReaperWatchDog(CTSReaper reaper, CoreTokenConfig config,
                             ReaperShutdownMonitor monitor,
                             @Named(CoreTokenConstants.CTS_SCHEDULED_SERVICE) ScheduledExecutorService scheduledService,
                             @Named(CoreTokenConstants.CTS_WORKER_POOL) ExecutorService workerPool,
                             @Named(CoreTokenConstants.CTS_REAPER_DEBUG) Debug debug); void startReaper(); }
CTSReaperWatchDog { public void startReaper() { if (monitor.isShutdown()) { log("Not scheduling the Watch Dog, shutdown in progress."); return; } log("Scheduling the CTS Reaper every " + config.getRunPeriod() + "ms"); workerPool.submit(new WatchDog()); } @Inject  CTSReaperWatchDog(CTSReaper reaper, CoreTokenConfig config,
                             ReaperShutdownMonitor monitor,
                             @Named(CoreTokenConstants.CTS_SCHEDULED_SERVICE) ScheduledExecutorService scheduledService,
                             @Named(CoreTokenConstants.CTS_WORKER_POOL) ExecutorService workerPool,
                             @Named(CoreTokenConstants.CTS_REAPER_DEBUG) Debug debug); void startReaper();  }