|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectfoxtrot.AbstractWorkerThread
foxtrot.workers.SingleWorkerThread
foxtrot.workers.MultiWorkerThread
public class MultiWorkerThread
Full implementation of WorkerThread that uses one or more threads to run
Tasks subclasses.
Tasks execution is parallelized: two tasks posted at the same time are executed in parallel
by two different threads.
This is done by using a mechanism similar to a classic web server threading: one thread
waits for incoming tasks and a new thread is spawned to run the task.
This ensures that the SingleWorkerThread.postTask(foxtrot.Task) method returns immediately in any case.
| Constructor Summary | |
|---|---|
MultiWorkerThread()
|
|
| Method Summary | |
|---|---|
protected java.lang.String |
getThreadName()
Returns the name of the worker thread used by this WorkerThread. |
boolean |
isWorkerThread()
Returns whether the current thread is a thread used by the implementation of this WorkerThread to run Tasks. |
protected void |
run(Task task)
Executes the given Task. |
| Methods inherited from class foxtrot.workers.SingleWorkerThread |
|---|
isAlive, isThreadInterrupted, postTask, run, start, stop, takeTask |
| Methods inherited from class foxtrot.AbstractWorkerThread |
|---|
runTask |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MultiWorkerThread()
| Method Detail |
|---|
protected java.lang.String getThreadName()
SingleWorkerThread
getThreadName in class SingleWorkerThreadprotected void run(Task task)
SingleWorkerThreadTask.
This implementation will just call AbstractWorkerThread.runTask(foxtrot.Task).
run in class SingleWorkerThreadpublic boolean isWorkerThread()
WorkerThreadTasks.
isWorkerThread in interface WorkerThreadisWorkerThread in class SingleWorkerThread
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||