### Question:
Scheduler extends ServiceSupport { public synchronized void executePeriodically(final Runnable task, long period) { TimerTask existing = timerTasks.get(task); if (existing != null) { LOG.debug("Task {} already scheduled, cancelling and rescheduling", task); cancel(task); } TimerTask timerTask = new SchedulerTimerTask(task); timer.schedule(timerTask, period, period); timerTasks.put(task, timerTask); } Scheduler(String name); synchronized void executePeriodically(final Runnable task, long period); synchronized void cancel(Runnable task); synchronized void executeAfterDelay(final Runnable task, long redeliveryDelay); void shutdown(); String getName();  }### Answer:
@Test public void testExecutePeriodically() throws Exception { final CountDownLatch latch = new CountDownLatch(1); scheduler.executePeriodically(new CountDownRunnable(latch), 10); assertTrue(latch.await(5000, TimeUnit.MILLISECONDS)); }