dsto.dfc.util
Class MultiplexedThread
java.lang.Object
java.lang.Thread
dsto.dfc.util.MultiplexedThread
- All Implemented Interfaces:
- Runnable
public class MultiplexedThread
- extends Thread
Allows a thread to be multiplexed into several scheduled Runnable's. This is
essentially Matthew's simple version of java.util.Timer that (a) allows tasks
to re-schedule themselves inside their run () method (why did Sun actively
block that?) and (b) allows managed shutdown-and-join (no way to tell when a
cancelled Timer has finished running tasks).
- Author:
- Matthew Phillips
Method Summary |
void |
run()
|
void |
schedule(Runnable runnable,
long time)
Schedule a runnable for execution. |
void |
shutdown()
Requests shutdown of the thread. |
Methods inherited from class java.lang.Thread |
activeCount, 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, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
MultiplexedThread
public MultiplexedThread()
shutdown
public void shutdown()
- Requests shutdown of the thread. If a runnable is executing it is
completed.
schedule
public void schedule(Runnable runnable,
long time)
- Schedule a runnable for execution.
- Parameters:
runnable
- The runnable.time
- The time to run at.
run
public void run()
- Specified by:
run
in interface Runnable
- Overrides:
run
in class Thread
Copyright © 2008 Commonwealth of Australia