@Test void repeatTaskWorks() throws Exception { VelocityScheduler scheduler = new VelocityScheduler(new FakePluginManager()); CountDownLatch latch = new CountDownLatch(3); ScheduledTask task = scheduler.buildTask(FakePluginManager.PLUGIN_A, latch::countDown) .delay(100, TimeUnit.MILLISECONDS) .repeat(100, TimeUnit.MILLISECONDS) .schedule(); latch.await(); task.cancel(); }
@Override public TaskBuilder buildTask(Object plugin, Runnable runnable) { checkNotNull(plugin, "plugin"); checkNotNull(runnable, "runnable"); checkArgument(pluginManager.fromInstance(plugin).isPresent(), "plugin is not registered"); return new TaskBuilderImpl(plugin, runnable); }
VelocityScheduler implements Scheduler { @Override public TaskBuilder buildTask(Object plugin, Runnable runnable) { checkNotNull(plugin, "plugin"); checkNotNull(runnable, "runnable"); checkArgument(pluginManager.fromInstance(plugin).isPresent(), "plugin is not registered"); return new TaskBuilderImpl(plugin, runnable); } }
VelocityScheduler implements Scheduler { @Override public TaskBuilder buildTask(Object plugin, Runnable runnable) { checkNotNull(plugin, "plugin"); checkNotNull(runnable, "runnable"); checkArgument(pluginManager.fromInstance(plugin).isPresent(), "plugin is not registered"); return new TaskBuilderImpl(plugin, runnable); } VelocityScheduler(PluginManager pluginManager); }
VelocityScheduler implements Scheduler { @Override public TaskBuilder buildTask(Object plugin, Runnable runnable) { checkNotNull(plugin, "plugin"); checkNotNull(runnable, "runnable"); checkArgument(pluginManager.fromInstance(plugin).isPresent(), "plugin is not registered"); return new TaskBuilderImpl(plugin, runnable); } VelocityScheduler(PluginManager pluginManager); @Override TaskBuilder buildTask(Object plugin, Runnable runnable); boolean shutdown(); }
VelocityScheduler implements Scheduler { @Override public TaskBuilder buildTask(Object plugin, Runnable runnable) { checkNotNull(plugin, "plugin"); checkNotNull(runnable, "runnable"); checkArgument(pluginManager.fromInstance(plugin).isPresent(), "plugin is not registered"); return new TaskBuilderImpl(plugin, runnable); } VelocityScheduler(PluginManager pluginManager); @Override TaskBuilder buildTask(Object plugin, Runnable runnable); boolean shutdown();  }