|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.lang.Thread | +--org.erights.e.extern.timer.TimerThread
Thread to handle timeouts and clocks.
Field Summary | |
private static int |
FUDGE
|
private Object |
myLock
|
private boolean |
myRunning
Flag to control execution |
private TimerQEntry |
myTopEntry
queue of pending timer events |
Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
(package private) |
TimerThread()
Package level constructor |
Method Summary | |
(package private) boolean |
cancelTimeout(TimerWatcher target)
Cancel a previously scheduled timer event. |
private void |
insertEntry(TimerQEntry newEntry)
Insert a new event into the timer queue (in order). |
private void |
orderEntries()
Sort the timer queue entries in order of time. |
void |
run()
Run the timer thread until told to stop. |
private void |
runloop()
The actual guts of the timer thread: Look for the next event on the timer queue. |
(package private) void |
setAlarm(long absMillis,
TimerWatcher target)
Set a timeout event to happen. |
(package private) void |
setClock(TimerWatcher target,
long deltaMillis)
Set a timeout event to happen. |
(package private) void |
shutdown()
Stop the thread. |
private void |
wakeup()
Wake up the sleeping runloop. |
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 final Object myLock
private TimerQEntry myTopEntry
private boolean myRunning
private static final int FUDGE
Constructor Detail |
TimerThread()
Method Detail |
boolean cancelTimeout(TimerWatcher target)
target
- Object whose event this is.private void insertEntry(TimerQEntry newEntry)
newEntry
- A TimerQEntry describing the new event.private void orderEntries()
public void run()
run
in interface Runnable
run
in class Thread
java.lang.Thread#start()
,
java.lang.Thread#stop()
,
java.lang.Thread#Thread(java.lang.ThreadGroup,
java.lang.Runnable, java.lang.String)
,
java.lang.Runnable#run()
private void runloop()
void setAlarm(long absMillis, TimerWatcher target)
absMillis
- When the event should happentarget
- Object which will handle the timeout event when it occursvoid setClock(TimerWatcher target, long deltaMillis)
target
- Object which will handle the timeout event when it occursdeltaMillis
- Distance into the future for event to happenvoid shutdown()
private void wakeup()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |