Field Summary |
|
final public static RunnableQueueState | RUNNING The queue is in the processes of running tasks. |
final public static RunnableQueueState | SUSPENDED The queue is no longer running any tasks and will not
run any tasks until resumeExecution is called. |
final public static RunnableQueueState | SUSPENDING The queue may still be running tasks but as soon as possible
will go to SUSPENDED state. |
protected DoublyLinkedList | list The Runnable objects list, also used as synchoronization point
for pushing/poping runables. |
protected int | preemptCount |
protected RunHandler | runHandler The object which handle run events. |
protected Thread | runnableQueueThread The current thread. |
protected RunnableQueueState | state The Suspension state of this thread. |
protected Object | stateLock Object to synchronize/wait/notify for suspension
issues. |
Method Summary |
|
public static RunnableQueue | createRunnableQueue() Creates a new RunnableQueue started in a new thread. |
protected synchronized void | executionResumed() Called when execution is being resumed. |
protected synchronized void | executionSuspended() Called when execution is being suspended. |
public Object | getIteratorLock() Returns iterator lock to use to work with the iterator
returned by iterator(). |
public RunnableQueueState | getQueueState() |
public synchronized RunHandler | getRunHandler() Returns the RunHandler or null. |
public Thread | getThread() Returns the thread in which the RunnableQueue is currently running. |
public void | invokeAndWait(Runnable r) Waits until the given Runnable's run() has returned. |
public void | invokeLater(Runnable r) Schedules the given Runnable object for a later invocation, and
returns. |
public Iterator | iterator() Returns an iterator over the runnables. |
public void | preemptAndWait(Runnable r) Waits until the given Runnable's run() has returned. |
public void | preemptLater(Runnable r) Schedules the given Runnable object for a later invocation, and
returns. |
public void | resumeExecution() Resumes the execution of this queue. |
public void | run() Runs this queue. |
protected synchronized void | runnableInvoked(Runnable rable) Called when a Runnable completes. |
public synchronized void | setRunHandler(RunHandler rh) Sets the RunHandler for this queue. |
public void | suspendExecution(boolean waitTillSuspended) Suspends the execution of this queue after the current runnable
completes.
Parameters: waitTillSuspended - if true this method will not returnuntil the queue has suspended (no runnable in progressor about to be in progress). |