|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.samskivert.util.SerialExecutor
public class SerialExecutor
Executes tasks serially, but each one on a separate thread. If a task times out, the executor will attempt to interrupt the thread and abort the task, but will abandon the thread in any case after the abort attempt so that subsequent tasks can be processed. The threads created are daemon threads so that they will not block the eventual termination of the virtual machine.
| Nested Class Summary | |
|---|---|
static interface |
SerialExecutor.ExecutorTask
A task to run in serial on the executor. |
protected class |
SerialExecutor.ExecutorThread
The basic processing unit of the Executor. |
| Field Summary | |
|---|---|
protected boolean |
_executingNow
True if there is a thread currently executing a task. |
protected ArrayList<SerialExecutor.ExecutorTask> |
_queue
The queue of tasks to execute. |
protected RunQueue |
_receiver
The receiver to which we post a unit to process results. |
| Constructor Summary | |
|---|---|
SerialExecutor(RunQueue receiver)
Construct the SerialExecutor. |
|
| Method Summary | |
|---|---|
void |
addTask(SerialExecutor.ExecutorTask task)
Add a task to the executor, it is expected that this method is called on the ResultReceiver thread. |
protected void |
checkNext()
Execute the next task, if applicable. |
int |
getQueueSize()
Returns the number of ExecutorTasks that are currently waiting on the queue. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected RunQueue _receiver
protected boolean _executingNow
protected ArrayList<SerialExecutor.ExecutorTask> _queue
| Constructor Detail |
|---|
public SerialExecutor(RunQueue receiver)
| Method Detail |
|---|
public void addTask(SerialExecutor.ExecutorTask task)
public int getQueueSize()
protected void checkNext()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||