List of utility methods to do Timer Usage
void | schedule(final TimerTask task, final int delay, final int period) schedule if (tasks.contains(task)) { return; TIMER.schedule(task, delay, period); tasks.add(task); |
void | schedule(TimerTask task, long delay, long period, String name) schedule Timer timer = new Timer(name, true);
timer.schedule(task, delay, period);
|
void | startTimerWithDelayInMillis(TimerTask task, long millisToDelay, long intervalInMillis) start Timer With Delay In Millis Timer timer = new Timer(true);
timer.schedule(task, millisToDelay, intervalInMillis);
|
void | stop(final TimerTask task) stop task.cancel(); tasks.remove(task); |
void | stopPrintStackTraces() Stop any scheduled stack dumps synchronized (LOCK) { if (timer != null) { timer.cancel(); timer = null; |
TimerTask | timerTask(Runnable runnable) Wraps Runnable to TimerTask return new TimerTask() { @Override public void run() { runnable.run(); }; |