@Test public void periodicFixedDelayTask() throws InterruptedException { final CountDownLatch countDownLatch = new CountDownLatch(4); final ScheduledFuture<?> scheduledFuture = scheduledService.periodicFixedDelayTask(1, null, countDownLatch); LOGGER.info("Do some other work while we wait for the tasks"); countDownLatch.await(500, TimeUnit.MILLISECONDS); if (!scheduledFuture.isCancelled()) { scheduledFuture.cancel(true); LOGGER.info("task stopped"); } }
public ScheduledFuture<?> periodicFixedDelayTask(final int value, final String errorMessage, final CountDownLatch countDownLatch) { LOGGER.info("longRunnableTask scheduled"); return executor.scheduleAtFixedRate( longRunnableTask(value, 10, errorMessage, countDownLatch), 0, 100, TimeUnit.MILLISECONDS); }
ManagedScheduledService { public ScheduledFuture<?> periodicFixedDelayTask(final int value, final String errorMessage, final CountDownLatch countDownLatch) { LOGGER.info("longRunnableTask scheduled"); return executor.scheduleAtFixedRate( longRunnableTask(value, 10, errorMessage, countDownLatch), 0, 100, TimeUnit.MILLISECONDS); } }
ManagedScheduledService { public ScheduledFuture<?> periodicFixedDelayTask(final int value, final String errorMessage, final CountDownLatch countDownLatch) { LOGGER.info("longRunnableTask scheduled"); return executor.scheduleAtFixedRate( longRunnableTask(value, 10, errorMessage, countDownLatch), 0, 100, TimeUnit.MILLISECONDS); }  }
ManagedScheduledService { public ScheduledFuture<?> periodicFixedDelayTask(final int value, final String errorMessage, final CountDownLatch countDownLatch) { LOGGER.info("longRunnableTask scheduled"); return executor.scheduleAtFixedRate( longRunnableTask(value, 10, errorMessage, countDownLatch), 0, 100, TimeUnit.MILLISECONDS); }  Future<Integer> singleFixedDelayTask(final int value,
                                                final String errorMessage); ScheduledFuture<?> periodicFixedDelayTask(final int value,
                                                     final String errorMessage,
                                                     final CountDownLatch countDownLatch); }
ManagedScheduledService { public ScheduledFuture<?> periodicFixedDelayTask(final int value, final String errorMessage, final CountDownLatch countDownLatch) { LOGGER.info("longRunnableTask scheduled"); return executor.scheduleAtFixedRate( longRunnableTask(value, 10, errorMessage, countDownLatch), 0, 100, TimeUnit.MILLISECONDS); }  Future<Integer> singleFixedDelayTask(final int value,
                                                final String errorMessage); ScheduledFuture<?> periodicFixedDelayTask(final int value,
                                                     final String errorMessage,
                                                     final CountDownLatch countDownLatch);  }