@Override public void stop() { if (!getTimer().isShutdown()) { getTimer().stop(); } super.stop(); }
/** * Schedule a task for execution at varying intervals. After execution, the task will get rescheduled after * {@link org.jgroups.util.TimeScheduler.Task#nextInterval()} milliseconds. The task is neve done until nextInterval() * return a value <= 0 or the task is cancelled. * @param task the task to execute * @param relative scheduling scheme: <tt>true</tt>:<br> * Task is rescheduled relative to the last time it <i>actually</i> started execution<p/> * <tt>false</tt>:<br> Task is scheduled relative to its <i>last</i> execution schedule. This has the effect * that the time between two consecutive executions of the task remains the same.<p/> * Note that relative is always true; we always schedule the next execution relative to the last *actual* * (not scheduled) execution */ public ScheduledFuture<?> scheduleWithDynamicInterval(Task task, boolean relative) { if(task == null) throw new NullPointerException(); if (isShutdown()) return null; TaskWrapper task_wrapper=new TaskWrapper(task); task_wrapper.doSchedule(); // calls schedule() in ScheduledThreadPoolExecutor return task_wrapper; }
@Override public void stop() { super.stop(); if (!getTimer().isShutdown()) { getTimer().stop(); } }