@Test(timeout = 15000) public void run_one_cycle() throws Exception { CompletableFuture<Object> run_implementation_called = new CompletableFuture<Object>(); Mockito .doAnswer((Answer) (InvocationOnMock invocation) -> { run_implementation_called.complete(null); return null; }) .when(processor).accept(Mockito.any(), Mockito.any(), Mockito.anyLong()); try (PushProcessorPipeline impl = new PushProcessorPipeline(registry, 10, processor)) { impl.start(); run_implementation_called.get(); } Mockito.verify(processor, Mockito.times(1)).accept(Mockito.any(), Mockito.any(), Mockito.anyLong()); }
public void start(boolean daemon, int thread_priority) { if (thread_priority < Thread.MIN_PRIORITY) throw new IllegalArgumentException("thread priority too low"); if (thread_priority > Thread.MAX_PRIORITY) throw new IllegalArgumentException("thread priority too high"); start_(Executors.newSingleThreadScheduledExecutor((Runnable r) -> { logger.entering(getClass().getName(), "start_", r); Thread t = new Thread(r, "monsoon processor"); t.setDaemon(daemon); t.setPriority(thread_priority); return t; }), true); }
PushProcessorPipeline extends AbstractProcessor<PushMetricRegistryInstance> implements Runnable { public void start(boolean daemon, int thread_priority) { if (thread_priority < Thread.MIN_PRIORITY) throw new IllegalArgumentException("thread priority too low"); if (thread_priority > Thread.MAX_PRIORITY) throw new IllegalArgumentException("thread priority too high"); start_(Executors.newSingleThreadScheduledExecutor((Runnable r) -> { logger.entering(getClass().getName(), "start_", r); Thread t = new Thread(r, "monsoon processor"); t.setDaemon(daemon); t.setPriority(thread_priority); return t; }), true); } }
PushProcessorPipeline extends AbstractProcessor<PushMetricRegistryInstance> implements Runnable { public void start(boolean daemon, int thread_priority) { if (thread_priority < Thread.MIN_PRIORITY) throw new IllegalArgumentException("thread priority too low"); if (thread_priority > Thread.MAX_PRIORITY) throw new IllegalArgumentException("thread priority too high"); start_(Executors.newSingleThreadScheduledExecutor((Runnable r) -> { logger.entering(getClass().getName(), "start_", r); Thread t = new Thread(r, "monsoon processor"); t.setDaemon(daemon); t.setPriority(thread_priority); return t; }), true); } PushProcessorPipeline(PushMetricRegistryInstance registry, int interval_seconds, List<PushProcessor> processors);  PushProcessorPipeline(PushMetricRegistryInstance registry, int interval_seconds, PushProcessor processor); }
PushProcessorPipeline extends AbstractProcessor<PushMetricRegistryInstance> implements Runnable { public void start(boolean daemon, int thread_priority) { if (thread_priority < Thread.MIN_PRIORITY) throw new IllegalArgumentException("thread priority too low"); if (thread_priority > Thread.MAX_PRIORITY) throw new IllegalArgumentException("thread priority too high"); start_(Executors.newSingleThreadScheduledExecutor((Runnable r) -> { logger.entering(getClass().getName(), "start_", r); Thread t = new Thread(r, "monsoon processor"); t.setDaemon(daemon); t.setPriority(thread_priority); return t; }), true); } PushProcessorPipeline(PushMetricRegistryInstance registry, int interval_seconds, List<PushProcessor> processors);  PushProcessorPipeline(PushMetricRegistryInstance registry, int interval_seconds, PushProcessor processor); @Override final void run(); final int getIntervalSeconds(); void start(boolean daemon, int thread_priority); void start(); void start(boolean daemon); void start(int thread_priority); void start(ScheduledExecutorService ses); ScheduledFuture<?> createTimerTask(ScheduledExecutorService ses); @Override void close(); }
PushProcessorPipeline extends AbstractProcessor<PushMetricRegistryInstance> implements Runnable { public void start(boolean daemon, int thread_priority) { if (thread_priority < Thread.MIN_PRIORITY) throw new IllegalArgumentException("thread priority too low"); if (thread_priority > Thread.MAX_PRIORITY) throw new IllegalArgumentException("thread priority too high"); start_(Executors.newSingleThreadScheduledExecutor((Runnable r) -> { logger.entering(getClass().getName(), "start_", r); Thread t = new Thread(r, "monsoon processor"); t.setDaemon(daemon); t.setPriority(thread_priority); return t; }), true); } PushProcessorPipeline(PushMetricRegistryInstance registry, int interval_seconds, List<PushProcessor> processors);  PushProcessorPipeline(PushMetricRegistryInstance registry, int interval_seconds, PushProcessor processor); @Override final void run(); final int getIntervalSeconds(); void start(boolean daemon, int thread_priority); void start(); void start(boolean daemon); void start(int thread_priority); void start(ScheduledExecutorService ses); ScheduledFuture<?> createTimerTask(ScheduledExecutorService ses); @Override void close();  }