|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.cuny.cat.task.PrioritySynchronousDispatcher
public class PrioritySynchronousDispatcher
A synchronous task dispatcher without any internal thread. It allows to use a task comparator and the task IDs to support a stable priority queue of tasks.
PriorityAsynchronousDispatcher| Field Summary | |
|---|---|
protected int |
counter
|
protected boolean |
running
|
protected java.util.PriorityQueue<DispatchingTask> |
tasks
|
| Constructor Summary | |
|---|---|
PrioritySynchronousDispatcher(java.util.Comparator<DispatchingTask> comparator)
|
|
| Method Summary | |
|---|---|
void |
addTask(DispatchingTask task)
adds a dispatching task to process. |
DispatchingTask[] |
getTasks()
|
void |
process()
to process the pending tasks. |
void |
processTask(DispatchingTask task)
to add the task and process all pending tasks. |
void |
terminate()
terminates the dispatcher. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final java.util.PriorityQueue<DispatchingTask> tasks
protected boolean running
protected int counter
| Constructor Detail |
|---|
public PrioritySynchronousDispatcher(java.util.Comparator<DispatchingTask> comparator)
| Method Detail |
|---|
public void addTask(DispatchingTask task)
Dispatcher
addTask in interface Dispatchertask - task to processpublic void process()
Dispatcher
process in interface Dispatcherpublic void processTask(DispatchingTask task)
DispatcherDispatcher.addTask(DispatchingTask) and Dispatcher.process() do together.
processTask in interface Dispatcherpublic void terminate()
Dispatcher
terminate in interface Dispatcherpublic DispatchingTask[] getTasks()
getTasks in interface Dispatcher
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||