java.util
class: TimerThread [javadoc |
source]
java.lang.Object
java.lang.Thread
java.util.TimerThread
All Implemented Interfaces:
Runnable
This "helper class" implements the timer's task execution thread, which
waits for tasks on the timer queue, executions them when they fire,
reschedules repeating tasks, and removes cancelled tasks and spent
non-repeating tasks from the queue.
| Field Summary |
|---|
| boolean | newTasksMayBeScheduled | This flag is set to false by the reaper to inform us that there
are no more live references to our Timer object. Once this flag
is true and there are no more tasks in our queue, there is no
work left for us to do, so we terminate gracefully. Note that
this field is protected by queue's monitor! |
| Method from java.util.TimerThread Summary: |
|---|
|
run |
| Methods from java.lang.Thread: |
|---|
|
activeCount, blockedOn, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, run, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
| Methods from java.lang.Object: |
|---|
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method from java.util.TimerThread Detail: |
public void run() {
try {
mainLoop();
} finally {
// Someone killed this Thread, behave as if Timer cancelled
synchronized(queue) {
newTasksMayBeScheduled = false;
queue.clear(); // Eliminate obsolete references
}
}
}
|