com.samskivert.util
Class BasicRunQueue
java.lang.Object
java.lang.Thread
com.samskivert.util.LoopingThread
com.samskivert.util.BasicRunQueue
- All Implemented Interfaces:
- RunQueue, Runnable
public class BasicRunQueue
- extends LoopingThread
- implements RunQueue
A very basic implementation of RunQueue for general purpose use.
| Fields inherited from interface com.samskivert.util.RunQueue |
AWT |
|
Constructor Summary |
BasicRunQueue()
Construct a BasicRunQueue with a default Queue implementation and name. |
BasicRunQueue(String name)
Construct a BasicRunQueue with a default Queue implementation and the given name. |
|
Method Summary |
boolean |
isDispatchThread()
|
protected void |
iterate()
This is the main body of the loop. |
protected void |
kick()
Called to wake the thread up from any blocking wait that it might
be in. |
void |
postRunnable(Runnable r)
Post the specified Runnable to be run on the RunQueue. |
| 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 |
_queue
protected Queue<Runnable> _queue
- The queue of things to run.
BasicRunQueue
public BasicRunQueue()
- Construct a BasicRunQueue with a default Queue implementation and name.
BasicRunQueue
public BasicRunQueue(String name)
- Construct a BasicRunQueue with a default Queue implementation and the given name.
postRunnable
public void postRunnable(Runnable r)
- Description copied from interface:
RunQueue
- Post the specified Runnable to be run on the RunQueue.
- Specified by:
postRunnable in interface RunQueue
isDispatchThread
public boolean isDispatchThread()
- Specified by:
isDispatchThread in interface RunQueue
- Returns:
- true if the calling thread is the RunQueue dispatch thread.
iterate
protected void iterate()
- Description copied from class:
LoopingThread
- This is the main body of the loop. It will be called over and over
again until the thread is requested to exit via a call to
LoopingThread.shutdown(). At minimum, a derived class must override this function
and do something useful.
- Overrides:
iterate in class LoopingThread
kick
protected void kick()
- Description copied from class:
LoopingThread
- Called to wake the thread up from any blocking wait that it might
be in. This function should result in the thread exiting the
LoopingThread.iterate() function as soon as possible so that the running flag can
be checked and the thread can cleanly exit.
- Overrides:
kick in class LoopingThread
Copyright © 2000-2008 Michael Bayne.
All Rights Reserved.