public abstract class AbstractServerBatchTask<S extends ServerContext> extends AbstractRemoteTask<S>
file
.
Batch-processes are queued for execution in ServerBatchTaskExecutor
, a special
single-thread-executor that runs only one task at a time.
Because the executor may be kept busy by a task for an unpredictable time there is no
guarantee about the exact execution start time of the next task scheduled. Tasks that are
willing to run just got to wait until the executor is free again.
AbstractServerBatchTask
s send ServerBatchTaskEvent
s to all clients that have
been registered for the NetMessageType.SERVER_BATCH_TASK_EVENT
.NetMessageType
childTaskRef, isTestMode, monitorController, resultRef, stateFlag
Constructor and Description |
---|
AbstractServerBatchTask(S serverCtx,
ServerBatchTaskConfigEntry cfgEntry) |
Modifier and Type | Method and Description |
---|---|
protected TaskMonitor |
createTaskMonitor() |
protected void |
doOnCancel()
This method is called after having detected cancellation.
|
protected void |
doOnFinish()
Is called in ANY CASE when the task has finished.
|
protected void |
doOnStart()
Is called when the task actually has started.
|
boolean |
equals(java.lang.Object obj)
Two server processes have unique Names.
|
protected java.util.concurrent.ScheduledFuture |
getCurrentFuture()
Returns the
Future of this task as returned by the thread-pool. |
ServerBatchTaskConfigEntry |
getProcessConfigEntry() |
int |
hashCode() |
ResourceLock |
lockDataSource(java.lang.String dataSourceName) |
void |
notifyProgress(int step,
int maxSteps,
java.lang.String message)
Convenience method
|
void |
notifyProgress(java.lang.String message) |
void |
releaseLock(ResourceLock lock) |
DataSourceEntry |
resetToDefaultDataSource() |
DataSourceEntry |
resetToPreviousDataSource() |
DataSourceEntry |
selectDataSource(java.lang.String dataSourceName) |
void |
setConfigEntry(ServerBatchTaskConfigEntry newProcCfg) |
RemoteTaskId |
submitForDirectExecution(SessionId sessionId)
Runs this task immediately in to the
ServerBatchTaskExecutor . |
void |
submitForScheduledExecution()
(re)schedules this task for running periodically.
|
ToString |
toString(ToString s)
This method allows subclasses to add values to the existing ToString of the superclass.
|
addMonitor, cancel, createRunStateFlag, createTaskId, getKillerSessionId, getOwnerSessionId, getRunStateFlag, getSessionId, getTaskId, setSessionId, submit, submit
executeSubTask, getServerContext
awaitFinished, awaitFinished, awaitStarted, cancel, deregisterTask, doOnSuccess, executeAsync, executeChildTask, executeChildTask, getMaxChildTasks, getPriority, getProcessingDuration, getStartTime, getStopWatch, handleFinish, handleStart, handleSuccess, isRegisterForCancel, isRunning, notifyProceeded, registerTask, releaseStart, run, setCurrentFuture, setMaxChildTasks, setPriority, setRegisterForCancel, setReleaseTimeout, submitInternal, wasSucceeded
checkCancelled, checkForErrorAndRethrow, clearMonitors, 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, 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, executeAsync, 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 AbstractServerBatchTask(S serverCtx, ServerBatchTaskConfigEntry cfgEntry)
protected TaskMonitor createTaskMonitor()
createTaskMonitor
in class AbstractRemoteTask<S extends ServerContext>
protected java.util.concurrent.ScheduledFuture getCurrentFuture()
AbstractAsyncTask
Future
of this task as returned by the thread-pool.getCurrentFuture
in class AbstractAsyncTask<S extends ServerContext>
public ServerBatchTaskConfigEntry getProcessConfigEntry()
public void setConfigEntry(ServerBatchTaskConfigEntry newProcCfg)
public DataSourceEntry selectDataSource(java.lang.String dataSourceName) throws InvalidDataSourceException, ResourceLockedException
public DataSourceEntry resetToDefaultDataSource() throws InvalidDataSourceException, ResourceLockedException
public DataSourceEntry resetToPreviousDataSource() throws InvalidDataSourceException, ResourceLockedException
public ResourceLock lockDataSource(java.lang.String dataSourceName) throws java.lang.Exception
java.lang.Exception
public void releaseLock(ResourceLock lock) throws NotLockOwnerException
NotLockOwnerException
public void notifyProgress(int step, int maxSteps, java.lang.String message)
public void notifyProgress(java.lang.String message)
protected void doOnStart() throws java.lang.Exception
AbstractAsyncTask
doOnStart
in class AbstractAsyncTask<S extends ServerContext>
java.lang.Exception
protected void doOnCancel()
AbstractAsyncExecutable
doOnCancel
in class AbstractAsyncExecutable<S extends ServerContext>
protected void doOnFinish()
AbstractAsyncTask
doOnFinish
in class AbstractAsyncTask<S extends ServerContext>
public RemoteTaskId submitForDirectExecution(SessionId sessionId) throws java.lang.Exception
ServerBatchTaskExecutor
.
Note that this task runs ONLY ONCE and is NOT scheduled for later execution.sessionId
- the current task ownerjava.lang.Exception
public void submitForScheduledExecution()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public ToString toString(ToString s)
Dumpable
toString
in interface Dumpable
toString
in class AbstractAsyncTask<S extends ServerContext>
Copyright © 2013 EsprIT-Systems. All Rights Reserved.