|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.Thread com.bbn.openmap.layer.vpf.RunQueue
public class RunQueue
Implement a very basic thread scheduling mechanism. TerminatingRunnable objects get added to the queue. As the thread gets cpu time, it will sequentially dequeue and run the objects in the queue in a LIFO order. Duplicates are allowed in the queue. Run will get called exactly once for each enqueue call. Only one thread will run at a time. (The next object won't run until the previous one completes.)
Runnable.run()
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary |
---|
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
RunQueue()
default constructor. |
|
RunQueue(boolean isDaemon,
int priority,
boolean autoStart)
construct a thread in the default ThreadGroup with a few options set |
|
RunQueue(java.lang.ThreadGroup tg)
construct this thread in a particular ThreadGroup |
|
RunQueue(java.lang.ThreadGroup tg,
boolean isDaemon,
int priority,
boolean autoStart)
construct a thread in the default ThreadGroup with a few options set |
Method Summary | |
---|---|
void |
enqueue(TerminatingRunnable r)
Add an object to the queue of threads to run |
void |
run()
start going. |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, clone, 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 |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public RunQueue()
public RunQueue(java.lang.ThreadGroup tg)
tg
- the ThreadGroup to be in. null
means
the current ThreadGrouppublic RunQueue(boolean isDaemon, int priority, boolean autoStart)
isDaemon
- true
means be a daemon thread,
false
means don't.priority
- the value to use when calling setPriorityautoStart
- true
means call this.start()Thread.start()
public RunQueue(java.lang.ThreadGroup tg, boolean isDaemon, int priority, boolean autoStart)
tg
- the ThreadGroup to be inisDaemon
- true
means be a daemon thread,
false
means don't.priority
- the value to use when calling setPriorityautoStart
- true
means call this.start()Thread.start()
Method Detail |
---|
public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
public void enqueue(TerminatingRunnable r)
r
- the object to add
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |