Queues runnable objects and calls their run() methods in sequence from a
separate worker thread.
Revision History
No. Date Who What
--- ---- --- ----
1 2002-05-28 Darshan Synchronized on EventHandler instance to allow
synch between source-model and model-source
threads.
author: Darshan
Inner Class :public static interface ITaskExecutor
Field Summary
final public static ITaskExecutor
defaultExecutor The default executor; executes Runnable objects' run() methods.
Constructor Summary
public
EventHandler(String queueName) Creates an EventHandler, but does not start the worker thread.
setTaskExecutor(EventHandler.ITaskExecutor executor) Sets the executor used to run the objects in the queue.
Parameters: executor - An EventHandler.ITaskExecutor replacementfor the default executor.
Adds a job to the queue, usually a Runnable job (if the default
executor is in use).
Parameters: r - The job, usually a Runnable.
queueRunnable
public void queueRunnable(Object r, int index)(Code)
Adds a job to the queue at the specified position. The job is usually a
Runnable job (if the default executor is in use).
Parameters: r - The job, usually a Runnable. Parameters: index - The index on the queue at which to insert the Runnable.
Sets the executor used to run the objects in the queue.
Parameters: executor - An EventHandler.ITaskExecutor replacementfor the default executor. Note that nulling the executorwill create a do-nothing queue that simply discards thejobs on the queue.
Stops the worker thread as soon as the currently running Runnable
is finished. Pending queued events will be discarded and any open
progress indicator will be closed.