|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectfoxtrot.AbstractWorkerThread
foxtrot.workers.SingleWorkerThread
public class SingleWorkerThread
Full implementation of WorkerThread that uses a single worker thread to run
Tasks subclasses.
Tasks execution is serialized: tasks are enqueued and executed one after the other.
| Constructor Summary | |
|---|---|
SingleWorkerThread()
|
|
| Method Summary | |
|---|---|
protected String |
getThreadName()
Returns the name of the worker thread used by this WorkerThread. |
boolean |
isAlive()
Returns whether this WorkerThread is alive. |
protected boolean |
isThreadInterrupted()
Returns whether the worker thread has been interrupted or not. |
boolean |
isWorkerThread()
Returns whether the current thread is a thread used by the implementation of this WorkerThread to run Tasks. |
void |
postTask(Task t)
Posts the given Task onto an internal queue. |
void |
run()
The worker thread dequeues one Task from the internal queue via takeTask()
and then executes it. |
protected void |
run(Task task)
Executes the given Task. |
void |
start()
Starts this WorkerThread, responsible for running Tasks (not in the
Event Dispatch Thread). |
protected void |
stop()
Stops abruptly this WorkerThread. |
protected Task |
takeTask()
Removes and returns the first available Task from the internal queue. |
| 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 SingleWorkerThread()
| Method Detail |
|---|
public void start()
WorkerThreadTasks (not in the
Event Dispatch Thread).
Applets can stop threads used by implementations of this WorkerThread in any moment,
and this method also can be used to restart this WorkerThread
if it results that it is not alive anymore.
start in interface WorkerThreadWorkerThread.isAlive()protected String getThreadName()
protected void stop()
public boolean isAlive()
WorkerThread
isAlive in interface WorkerThreadWorkerThread.start()public boolean isWorkerThread()
WorkerThreadTasks.
isWorkerThread in interface WorkerThreadpublic void postTask(Task t)
postTask in interface WorkerThreadtakeTask()
protected Task takeTask()
throws InterruptedException
Task from the internal queue.
If no Tasks are available, this method blocks until a Task is posted via
postTask(foxtrot.Task)
InterruptedExceptionprotected boolean isThreadInterrupted()
Thread.isInterrupted()public void run()
Task from the internal queue via takeTask()
and then executes it.
run in interface Runnableprotected void run(Task task)
Task.
This implementation will just call AbstractWorkerThread.runTask(foxtrot.Task).
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||