public final class AgentExecutorTask extends AbstractRemoteTask<ServerContext>
AgentWatchDogTask
in order to detect an execution timeout.
The latter task is responsible for finalization of the agent.childTaskRef, isTestMode, monitorController, resultRef, stateFlag
Constructor and Description |
---|
AgentExecutorTask(ServerContext serverCtx,
AsyncAgent<ClientContext,ServerContext> agent) |
Modifier and Type | Method and Description |
---|---|
void |
cancel(SessionId killerSessId)
Cancels the running task and stores the
SessionId of the killer. |
protected RemoteTaskId |
createTaskId()
Overridden to 'abuse' the AgentId as TaskId.
|
protected TaskMonitor |
createTaskMonitor()
Has got a special Monitor that only reports the main task events.
|
protected void |
doOnCancel()
This method is called after having detected cancellation.
|
protected void |
doOnFailure(java.lang.Exception error)
Is called when the task failed.
|
boolean |
equals(java.lang.Object obj) |
void |
executeAsync()
Must be overridden to perform the async part.
|
AsyncAgent |
getAgent() |
AgentId |
getAgentId() |
int |
hashCode() |
ToString |
toString(ToString s)
This method allows subclasses to add values to the existing ToString of the superclass.
|
addMonitor, createRunStateFlag, getKillerSessionId, getOwnerSessionId, getRunStateFlag, getSessionId, getTaskId, setSessionId, submit, submit
executeSubTask, getServerContext
awaitFinished, awaitFinished, awaitStarted, cancel, deregisterTask, doOnFinish, doOnStart, doOnSuccess, executeChildTask, executeChildTask, getCurrentFuture, getMaxChildTasks, getPriority, getProcessingDuration, getStartTime, getStopWatch, handleFinish, handleStart, handleSuccess, isRegisterForCancel, isRunning, notifyProceeded, registerTask, releaseStart, run, setCurrentFuture, setMaxChildTasks, setPriority, setRegisterForCancel, setReleaseTimeout, submitInternal, wasSucceeded
checkCancelled, checkForErrorAndRethrow, clearMonitors, execute, executeSubTask, getError, getMaxProgressSteps, getMonitorCount, getMonitors, getName, getProgressStepCount, getResult, getType, handleCancellation, handleFailure, hasError, hasMonitor, isCancellable, registerTaskStateChange, removeMonitor, resetProgress, setCancellable, setLogLevel, setMaxProgressSteps, setMonitor, setName, setName, setResult, setRunStateFlag, setTaskId, setType, shouldFireMonitor, sleepChecked, wasCancelled
getApplicationContext, getLogChannel, isLogDebug, isLogVerbose, logDebug, logDump, logError, logError, logFatal, logInfo, logVerbose, logWarning, setLogChannel
configureDumpHeadlineLength, configureDumpMaxElementsPrinted, copyDumpStringValues, copyToStringValues, createDumpHeader, toDumpString, toDumpString, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
awaitFinished, awaitFinished, awaitStarted, executeChildTask, executeChildTask, getError, getProcessingDuration, hasError, isRegisterForCancel, isRunning, releaseStart, setName, setReleaseTimeout
checkCancelled, checkForErrorAndRethrow, executeSubTask, getName, getResult, getType, handleCancellation, handleFailure, isCancellable, notifyProceeded, setCancellable, setName, setResult, setRunStateFlag, sleepChecked
getApplicationContext
execute
clearMonitors, getMonitorCount, getMonitors, hasMonitor, removeMonitor
getLogChannel, isLogDebug, isLogVerbose, logDebug, logDump, logError, logError, logFatal, logInfo, logVerbose, logWarning, setLogChannel
cancel
wasCancelled
toDumpString, toDumpString, toString
getServerContext
public AgentExecutorTask(ServerContext serverCtx, AsyncAgent<ClientContext,ServerContext> agent)
protected final TaskMonitor createTaskMonitor()
createTaskMonitor
in class AbstractRemoteTask<ServerContext>
protected final RemoteTaskId createTaskId()
createTaskId
in class AbstractRemoteTask<ServerContext>
public final AsyncAgent getAgent()
public final AgentId getAgentId()
public final void executeAsync() throws java.lang.Exception
AbstractAsyncTask
AbstractAsyncTask.notifyProceeded(Object, int, int, String)
in order to notify
about task progress. Note: the running task should periodically call
AbstractAsyncExecutable.checkCancelled()
in order to detect cancellation.executeAsync
in interface AsyncExecutable<ServerContext>
executeAsync
in class AbstractAsyncTask<ServerContext>
java.lang.Exception
for synchronous execution
protected final void doOnCancel()
AbstractAsyncExecutable
doOnCancel
in class AbstractAsyncExecutable<ServerContext>
protected final void doOnFailure(java.lang.Exception error)
AbstractAsyncExecutable
doOnFailure
in class AbstractAsyncExecutable<ServerContext>
public final void cancel(SessionId killerSessId)
RemoteCancellableTask
SessionId
of the killer. Note that this call puts the
task in a CANCEL_REQUESTED state. The task itself needs to detect this and perform any action
needed for canceling itself - after all it puts itself in the cancelled state and
terminates. The method CancellableTask.wasCancelled()
returns true once a cancel was requested.cancel
in interface RemoteCancellableTask
cancel
in class AbstractRemoteTask<ServerContext>
public final boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public final int hashCode()
hashCode
in class java.lang.Object
public ToString toString(ToString s)
Dumpable
toString
in interface Dumpable
toString
in class AbstractAsyncTask<ServerContext>
Copyright © 2014 EsprIT-Systems. All Rights Reserved.