|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.ow2.jonas.lib.timer.TimerManager
public class TimerManager
A timer manager manages 2 lists of timers with 2 threads One thread is a clock which decrements timers every second and passes them when expired in a list of expired timers. The other thread looks in the list of expired timers to process them.
Method Summary | |
---|---|
TimerEvent |
addTimer(TimerEventListener tel,
long timeout,
Object arg,
boolean permanent)
Deprecated. use addTimerMs instead. |
TimerEvent |
addTimerMs(TimerEventListener tel,
long timeout,
Object arg,
boolean permanent)
add a new timer in the list |
void |
batch()
process all expired timers |
void |
clock()
update all timers in the list each timer expired is put in a special list of expired timers they will be processed then by the Batch Thread. |
static TimerManager |
getInstance()
Get an instance of the TimerManager |
void |
removeTimer(TimerEvent te)
Deprecated. |
static void |
stop()
|
static void |
stop(boolean force)
stop the service |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static TimerManager getInstance()
public static void stop(boolean force)
force
- tell the manager NOT to wait for the timers to be completedpublic static void stop()
public void clock()
public void batch()
public TimerEvent addTimer(TimerEventListener tel, long timeout, Object arg, boolean permanent)
tel
- Object that will be notified when the timer expire.timeout
- nb of seconds before the timer expires.arg
- info passed with the timerpermanent
- true if the timer is permanent.public TimerEvent addTimerMs(TimerEventListener tel, long timeout, Object arg, boolean permanent)
tel
- Object that will be notified when the timer expire.timeout
- nb of milliseconds before the timer expires.arg
- info passed with the timerpermanent
- true if the timer is permanent.public void removeTimer(TimerEvent te)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |