|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectfulmine.util.concurrent.TaskExecutor
public final class TaskExecutor
A single threaded Executor for tasks. This has an unbounded task
queue. There are 2 modes of operation for this;
There is a single global Timer used by all executors for handling the
scheduling of tasks via the schedule(TimerTask, long, long) method.
The actual task will be run by the TaskExecutor - the timer is merely
used to schedule a call to execute(Runnable) when the task is due
for (re)execution.
| Constructor Summary | |
|---|---|
TaskExecutor(String identity,
IFulmineContext context)
Construct the executor in event driven mode in the same thread group as the calling thread. |
|
TaskExecutor(String identity,
long pollingPeriod,
IFulmineContext context)
Construct the executor in polling or event driven mode in the same thread group as the calling thread. |
|
TaskExecutor(ThreadGroup threadGroup,
String identity,
IFulmineContext context)
Construct the executor in event driven mode with a specific priority |
|
| Method Summary | |
|---|---|
void |
destroy()
This is called when the object is being removed from application use. |
void |
execute(Runnable command)
Add the task to a queue for processing by a single thread |
StackTraceElement[] |
getStackTrace()
Get the current stack of the executor |
boolean |
isActive()
Determine if this life-cycle object is active. |
void |
schedule(TimerTask task,
long delay,
long period)
Schedule a timer task to be executed by a single worker thread. |
void |
start()
Activate (start) this object. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TaskExecutor(String identity,
IFulmineContext context)
identity - the identity of the executorcontext - required to construct the information container record, this
is done lazily
public TaskExecutor(String identity,
long pollingPeriod,
IFulmineContext context)
identity - the identity of the executorpollingPeriod - the polling period, in milliseconds or 0 or less
for event driven modecontext - required to construct the information container record, this
is done lazily
public TaskExecutor(ThreadGroup threadGroup,
String identity,
IFulmineContext context)
threadGroup - the thread group and priorityidentity - the identity of the executorcontext - required to construct the information container record, this
is done lazily| Method Detail |
|---|
public void execute(Runnable command)
ITaskExecutor
execute in interface ITaskExecutorexecute in interface Executorcommand - the task to add to a queue that is processed by a single
threadpublic boolean isActive()
ILifeCycle
isActive in interface ILifeCycletrue if the object is activepublic void start()
ILifeCycle
This method may throw a RuntimeException if it fails to activate
the object.
start in interface ILifeCyclepublic void destroy()
IDestroyable
This method must not throw a RuntimeException.
destroy in interface IDestroyablepublic StackTraceElement[] getStackTrace()
ITaskExecutor
getStackTrace in interface ITaskExecutorThread.getStackTrace()
public void schedule(TimerTask task,
long delay,
long period)
ITaskExecutor
schedule in interface ITaskExecutortask - task to be scheduled.delay - delay in milliseconds before task is to be executed.period - time in milliseconds between successive task executions.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||