foxtrot
Interface WorkerThread

All Known Implementing Classes:
AbstractWorkerThread, MultiWorkerThread, SingleWorkerThread

public interface WorkerThread

Implementations of this interface run Tasks in a thread that is not the Event Dispatch Thread.
Implementations should extend AbstractWorkerThread.

Version:
$Revision: 255 $

Method Summary
 boolean isAlive()
          Returns whether this WorkerThread is alive.
 boolean isWorkerThread()
          Returns whether the current thread is a thread used by the implementation of this WorkerThread to run Tasks.
 void postTask(Task task)
          Posts a Task to be run by this WorkerThread in a thread that is not the Event Dispatch Thread.
 void runTask(Task task)
          Runs the given Task.
 void start()
          Starts this WorkerThread, responsible for running Tasks (not in the Event Dispatch Thread).
 

Method Detail

start

void start()
Starts this WorkerThread, responsible for running Tasks (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.

See Also:
isAlive()

isAlive

boolean isAlive()
Returns whether this WorkerThread is alive. It is not enough to return whether this WorkerThread has been started, because Applets can stop threads used by implementations of this WorkerThread in any moment. If this WorkerThread is not alive, it must be restarted.

See Also:
start()

isWorkerThread

boolean isWorkerThread()
Returns whether the current thread is a thread used by the implementation of this WorkerThread to run Tasks.


postTask

void postTask(Task task)
Posts a Task to be run by this WorkerThread in a thread that is not the Event Dispatch Thread. This method must be called from the Event Dispatch Thread and should return immediately. Implementations should check if this WorkerThread isAlive() to guarantee that the posted Task will be executed by this WorkerThread.

See Also:
runTask(foxtrot.Task)

runTask

void runTask(Task task)
Runs the given Task. This method must be called by a thread that is not the Event Dispatch Thread, and must execute the task in the same thread of the caller, synchronously.

See Also:
postTask(foxtrot.Task)


Copyright © 2011 KnowledgePlaza. All Rights Reserved.