public void start(StatisticsManager statisticsManager, int sampleInterval, TimeUnit timeUnit) { ScheduledExecutorService executor = LoggingExecutors.newSingleThreadScheduledExecutor("CallbackSampler"); start(executor, statisticsManager, sampleInterval, timeUnit); }
private Runnable invokeStartAndGetTask() { sampler.start(executorService, statisticsManager, 1, TimeUnit.MILLISECONDS); ArgumentCaptor<Runnable> runnableCaptor = ArgumentCaptor.forClass(Runnable.class); verify(executorService).scheduleAtFixedRate(runnableCaptor.capture(), eq(1L), eq(1L), eq(TimeUnit.MILLISECONDS)); return runnableCaptor.getValue(); }
this.callbackSampler.start(getStatisticsManager(), getSampleRate(), TimeUnit.MILLISECONDS); statThread = new LoggingThread("StatSampler", this); statThread.setPriority(Thread.MAX_PRIORITY);
@Test public void stopShouldStopExecutor() { sampler.start(executorService, statisticsManager, 1, TimeUnit.MILLISECONDS); sampler.stop(); verify(executorService).shutdown(); }