Code example for Timer

Methods: purge

0
 
    public static synchronized void cancel(Runnable task) {
        TimerTask ticket = TIMER_TASKS.remove(task);
        if (ticket != null) {
            ticket.cancel();
            CLOCK_DAEMON.purge();//remove cancelled TimerTasks
        } 
    } 
 
    public static void executeAfterDelay(final Runnable task, long redeliveryDelay) {
        TimerTask timerTask = new SchedulerTimerTask(task);
        CLOCK_DAEMON.schedule(timerTask, redeliveryDelay);
    } 
 
    public static void shutdown() { 
        CLOCK_DAEMON.cancel();
    } 
 
} 
Stop searching for code, let great code find you!  Add Codota to your java IDE