|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--java.lang.Thread
|
+--irssibot.util.Timer
A generic timer. The timer is deployed as its own
thread with a given number of seconds and a
TimerCommand object reference. After the timer
period, the execute() method of the
TimerCommand object is invoked.
| Field Summary | |
private TimerCommand |
command
TimerCommand to execute |
private boolean |
isRunning
Indicates whether this timer is still alive |
private int |
period
Wait period |
private java.lang.Object |
waitLock
Wait lock |
| Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
private |
Timer(int period,
TimerCommand command)
Inits the timer. |
| Method Summary | |
static Timer |
deploy(int period,
TimerCommand command)
Deploys a Timer with given wait period and command object. |
void |
killTimer()
Kills this timer, ending the wait. |
void |
run()
Performs the actual wait / execute invokation. |
| Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
private boolean isRunning
private java.lang.Object waitLock
private int period
private TimerCommand command
| Constructor Detail |
private Timer(int period,
TimerCommand command)
period - number of seconds to wait before executing
commandcommand - object whose execute() method to call after
given period| Method Detail |
public static Timer deploy(int period,
TimerCommand command)
period seconds have passed, call the
execute() method of the command object.
period - number of seconds to wait before executing
commandcommand - object whose execute() method to call after
given period
java.lang.IllegalArgumentException - if period is out of
range or command parameter is nullpublic void run()
run in interface java.lang.Runnablerun in class java.lang.Threadpublic void killTimer()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||