abbot.util
Class NamedTimer

java.lang.Object
  extended by java.util.Timer
      extended by abbot.util.NamedTimer

public class NamedTimer
extends Timer

Prevents misbehaving TimerTasks from canceling the timer thread by throwing exceptions and/or errors. Also extends the basic Timer to use a name for its thread. Naming the timer thread facilitates discerning different threads in a full stack dump.


Constructor Summary
NamedTimer(String name)
          Creates a non-daemon named timer.
NamedTimer(String name, boolean isDaemon)
          Creates a named timer, optionally running as a daemon thread.
 
Method Summary
protected  void handleException(Throwable thrown)
          Handle an exception thrown by a TimerTask.
 void schedule(TimerTask task, Date time)
           
 void schedule(TimerTask task, Date firstTime, long period)
           
 void schedule(TimerTask task, long delay)
           
 void schedule(TimerTask task, long delay, long period)
           
 void scheduleAtFixedRate(TimerTask task, Date firstTime, long period)
           
 void scheduleAtFixedRate(TimerTask task, long delay, long period)
           
 
Methods inherited from class java.util.Timer
cancel, purge
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NamedTimer

public NamedTimer(String name)
Creates a non-daemon named timer.


NamedTimer

public NamedTimer(String name,
                  boolean isDaemon)
Creates a named timer, optionally running as a daemon thread.

Method Detail

handleException

protected void handleException(Throwable thrown)
Handle an exception thrown by a TimerTask. The default does nothing.


schedule

public void schedule(TimerTask task,
                     Date time)
Overrides:
schedule in class Timer

schedule

public void schedule(TimerTask task,
                     Date firstTime,
                     long period)
Overrides:
schedule in class Timer

schedule

public void schedule(TimerTask task,
                     long delay)
Overrides:
schedule in class Timer

schedule

public void schedule(TimerTask task,
                     long delay,
                     long period)
Overrides:
schedule in class Timer

scheduleAtFixedRate

public void scheduleAtFixedRate(TimerTask task,
                                Date firstTime,
                                long period)
Overrides:
scheduleAtFixedRate in class Timer

scheduleAtFixedRate

public void scheduleAtFixedRate(TimerTask task,
                                long delay,
                                long period)
Overrides:
scheduleAtFixedRate in class Timer


Copyright © 2002-2008 Timothy Wall. All Rights Reserved.
Abbot is hosted on

SourceForge