|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.waveset.task.Executor
The interface which must be implemented by any class that wants to implement a background task and be managed by the TaskManager.
I decided to make this an abstract class rather than an interface
so we can maintain a pool chain, and leave it open for other
things common to all executors. It also allows us to provide
default implementations for suspend
and
terminate
in case a task doesn't support them.
Field Summary | |
protected Monitor |
_monitor
Monitors task results. |
protected boolean |
_suspendRequested
Flag indicating that task suspension has been requested. |
protected boolean |
_terminateRequested
Flag indicating that task termination has been requested. |
static java.lang.String |
code_id
|
protected static Trace |
trace
|
protected static java.lang.String |
XML_HEADER
|
Constructor Summary | |
Executor()
|
Method Summary | |
protected void |
addExtendedResult(TaskContext context,
TaskInstance task,
int sequence,
TaskResult taskResult,
java.util.Map options)
Record an extended result for a task instance. |
protected void |
delete(TaskContext ctx,
TaskInstance task)
This method is invoked when a TaskInstance object that corresponds to this Executor is deleted. |
protected void |
doRealWork(TaskContext ctx,
TaskInstance task)
|
void |
execute(TaskContext ctx,
TaskInstance task)
Execute the task. |
RepositoryResult |
getExtendedResult(TaskContext context,
TaskInstance task,
java.util.Map options)
|
Executor |
getPool()
Get the pool pointer. |
boolean |
isSuspendRequested()
Test the suspend request flag. |
boolean |
isTerminateRequested()
Test the terminate request flag. |
protected static void |
println(java.lang.Object o)
The usual trace hack. |
void |
processEvent(TaskEvent ev)
Handle an extended event - not suspend or terminate |
void |
setPool(Executor p)
Set the pool pointer. |
void |
setSuspendRequested(boolean b)
Request suspension of the task. |
void |
setTerminateRequested(boolean b)
Request termination of the task. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String code_id
protected static Trace trace
protected static final java.lang.String XML_HEADER
protected Monitor _monitor
protected boolean _suspendRequested
protected boolean _terminateRequested
Constructor Detail |
public Executor()
Method Detail |
public void execute(TaskContext ctx, TaskInstance task)
doRealWork()
.
doRealWork(TaskContext, TaskInstance)
protected void doRealWork(TaskContext ctx, TaskInstance task) throws java.lang.Exception
java.lang.Exception
protected void delete(TaskContext ctx, TaskInstance task) throws java.lang.Exception
java.lang.Exception
protected final void addExtendedResult(TaskContext context, TaskInstance task, int sequence, TaskResult taskResult, java.util.Map options) throws WavesetException
If you need to pass in arguments that specify what the result should be, use name/value pairs in the options map.
WavesetException
public final RepositoryResult getExtendedResult(TaskContext context, TaskInstance task, java.util.Map options) throws WavesetException
The caller may have specified a range of sequence numbers in the map of options. This allows callers to "page" through large results so they can be examined and displayed incrementally.
WavesetException
TaskResult.FROM_SEQUENCE
,
TaskResult.TO_SEQUENCE
,
TaskResult.JUST_LIST_THEM
public void setSuspendRequested(boolean b)
This differs from terminate
in that the intent is
that the task store enough state in the task object so that
it can be resumed later.
public void setTerminateRequested(boolean b)
suspend
except that the intent is that
the task will not be resumed later.
public boolean isSuspendRequested()
public boolean isTerminateRequested()
public Executor getPool()
public void setPool(Executor p)
public void processEvent(TaskEvent ev)
protected static void println(java.lang.Object o)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |