public abstract class AbstractRemoteTask<S extends ServerContext> extends AbstractServerTask<S> implements RemoteTask<S>
AsyncTask which runs on server side and is owned by a user session.
You may attach a RemoteTaskMonitor if it should send RemoteTaskEvents
to the client for synchronization purposes. By default no monitor is attached.childTaskRef, isTestMode, monitorController, resultRef, stateFlag| Constructor and Description |
|---|
AbstractRemoteTask(S serverCtx,
LogChannel logCh,
RemoteTaskType taskType,
SessionId sessionId) |
AbstractRemoteTask(S serverCtx,
LogChannel logCh,
java.lang.String taskName,
RemoteTaskType taskType,
SessionId sessionId) |
AbstractRemoteTask(S serverCtx,
RemoteTaskType taskType,
SessionId sessionId) |
AbstractRemoteTask(S serverCtx,
SessionId sessionId) |
AbstractRemoteTask(S serverCtx,
java.lang.String taskName,
RemoteTaskType taskType,
SessionId sessionId) |
| Modifier and Type | Method and Description |
|---|---|
void |
addMonitor(TaskMonitor monitor)
Adds a
TaskMonitor which is notified about RunStateFlag changes |
void |
cancel(SessionId killerSessId)
Cancels the running task and stores the
SessionId of the killer. |
protected RunStateFlag |
createRunStateFlag()
Creates the
RunStateFlag instance of this task. |
protected RemoteTaskId |
createTaskId()
Is called at submit time.
|
protected TaskMonitor |
createTaskMonitor() |
SessionId |
getKillerSessionId()
Returns the
SessionId of the one who cancelled this task |
SessionId |
getOwnerSessionId()
Returns the
SessionId of the session that owns this task. |
RemoteRunStateFlag |
getRunStateFlag()
Returns the current
RunStateFlag. |
SessionId |
getSessionId()
Returns the
SessionId of the Session that submitted this task |
RemoteTaskId |
getTaskId()
Returns an identifier object for this task.
|
void |
setSessionId(SessionId sessionId)
Allows subtasks to set the sessionId explicitly.
|
RemoteTaskId |
submit()
Submits this task for execution to the default application thread pool
|
RemoteTaskId |
submit(java.util.concurrent.ExecutorService pool)
Submits this task for execution to the given thread pool
|
executeSubTask, getServerContextawaitFinished, awaitFinished, awaitStarted, cancel, deregisterTask, doOnFinish, doOnStart, doOnSuccess, executeAsync, executeChildTask, executeChildTask, getCurrentFuture, getMaxChildTasks, getPriority, getProcessingDuration, getStartTime, getStopWatch, handleFinish, handleStart, handleSuccess, isRegisterForCancel, isRunning, notifyProceeded, registerTask, releaseStart, run, setCurrentFuture, setMaxChildTasks, setPriority, setRegisterForCancel, setReleaseTimeout, submitInternal, toString, wasSucceededcheckCancelled, checkForErrorAndRethrow, clearMonitors, doOnCancel, doOnFailure, 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, wasCancelledgetApplicationContext, getLogChannel, isLogDebug, isLogVerbose, logDebug, logDump, logError, logError, logFatal, logInfo, logVerbose, logWarning, setLogChannelconfigureDumpHeadlineLength, configureDumpMaxElementsPrinted, copyDumpStringValues, copyToStringValues, createDumpHeader, toDumpString, toDumpString, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitawaitFinished, awaitFinished, awaitStarted, executeChildTask, executeChildTask, getError, getProcessingDuration, hasError, isRegisterForCancel, isRunning, releaseStart, setName, setReleaseTimeoutcheckCancelled, checkForErrorAndRethrow, executeAsync, executeSubTask, getName, getResult, getType, handleCancellation, handleFailure, isCancellable, notifyProceeded, setCancellable, setName, setResult, setRunStateFlag, sleepCheckedgetApplicationContextexecuteclearMonitors, getMonitorCount, getMonitors, hasMonitor, removeMonitorgetLogChannel, isLogDebug, isLogVerbose, logDebug, logDump, logError, logError, logFatal, logInfo, logVerbose, logWarning, setLogChannelcancelwasCancelledtoDumpString, toDumpString, toString, toStringgetServerContextpublic AbstractRemoteTask(S serverCtx, RemoteTaskType taskType, SessionId sessionId)
public AbstractRemoteTask(S serverCtx, LogChannel logCh, RemoteTaskType taskType, SessionId sessionId)
public AbstractRemoteTask(S serverCtx, java.lang.String taskName, RemoteTaskType taskType, SessionId sessionId)
public AbstractRemoteTask(S serverCtx, LogChannel logCh, java.lang.String taskName, RemoteTaskType taskType, SessionId sessionId)
public final void addMonitor(TaskMonitor monitor)
TaskMonitorSupportTaskMonitor which is notified about RunStateFlag changesaddMonitor in interface TaskMonitorSupportaddMonitor in class AbstractAsyncExecutable<S extends ServerContext>protected TaskMonitor createTaskMonitor()
public void cancel(SessionId killerSessId)
RemoteCancellableTaskSessionId 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 RemoteCancellableTaskprotected RemoteTaskId createTaskId()
AbstractAsyncTaskTaskId which
is added to the RunStateFlag.createTaskId in class AbstractAsyncTask<S extends ServerContext>public RemoteTaskId submit() throws java.lang.Exception
AsyncTasksubmit in interface AsyncTask<S extends ServerContext>submit in interface RemoteTask<S extends ServerContext>submit in class AbstractAsyncTask<S extends ServerContext>java.lang.Exception - if the pool is busypublic RemoteTaskId submit(java.util.concurrent.ExecutorService pool) throws java.lang.Exception
AsyncTasksubmit in interface AsyncTask<S extends ServerContext>submit in interface RemoteTask<S extends ServerContext>submit in class AbstractAsyncTask<S extends ServerContext>java.lang.Exception - if the pool is busyprotected final RunStateFlag createRunStateFlag()
AbstractAsyncExecutableRunStateFlag instance of this task.
Is only called once at construction time.createRunStateFlag in class AbstractAsyncExecutable<S extends ServerContext>public RemoteRunStateFlag getRunStateFlag()
AsyncExecutableRunStateFlag. Note that there is exactly one
RunStateFlag per running task. Child-tasks as well as sub-tasks share it with their
parents.getRunStateFlag in interface AsyncExecutable<S extends ServerContext>getRunStateFlag in interface RemoteTask<S extends ServerContext>getRunStateFlag in class AbstractAsyncExecutable<S extends ServerContext>public void setSessionId(SessionId sessionId)
public SessionId getOwnerSessionId()
RemoteTaskSessionId of the session that owns this task.
Note the difference to RemoteTask.getSessionId(). A task that runs i.e. in a CoClientContext
might have the SessionId of that context. But the real owner-id of the task is the SessionId
of the user that is logged in on the server!getOwnerSessionId in interface RemoteTask<S extends ServerContext>RemoteTask.getSessionId()public SessionId getSessionId()
RemoteTaskSessionId of the Session that submitted this taskgetSessionId in interface RemoteTask<S extends ServerContext>RemoteTask.getOwnerSessionId()public SessionId getKillerSessionId()
RemoteCancellableTaskSessionId of the one who cancelled this taskgetKillerSessionId in interface RemoteCancellableTaskpublic RemoteTaskId getTaskId()
AsyncExecutableTaskId is used to model the task-hierarchy in a RunStateFlag.
For AsyncExecutables it's always an instance of PseudoTaskId.getTaskId in interface AsyncExecutable<S extends ServerContext>getTaskId in interface TaskIdHoldergetTaskId in interface RemoteTask<S extends ServerContext>getTaskId in class AbstractAsyncExecutable<S extends ServerContext>Copyright © 2014 EsprIT-Systems. All Rights Reserved.