Code example for HashMap

Methods: remove

0
        CLOCK_DAEMON.schedule(timerTask, period, period);
        TIMER_TASKS.put(task, timerTask);
    } 
 
    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();
    }