public abstract class AbstractBatchTask<S extends ServerContext> extends AbstractRemoteTask<S>
file.
Batch-processes are queued for execution in BatchTaskExecutor, 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.
AbstractBatchTasks send BatchTaskEvents to all clients that have
been registered for the NetMessageType.SERVER_BATCH_TASK_EVENT.NetMessageTypechildTaskRef, isTestMode, monitorController, resultRef, stateFlag| Constructor and Description |
|---|
AbstractBatchTask(S serverCtx,
BatchTaskConfigEntry 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. |
BatchTaskConfigEntry |
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) |
DatabaseConnection |
resetToDefaultDataSource() |
DatabaseConnection |
resetToPreviousDataSource() |
DatabaseConnection |
selectDataSource(java.lang.String dataSourceName) |
void |
setConfigEntry(BatchTaskConfigEntry newProcCfg) |
RemoteTaskId |
submitForDirectExecution(SessionId sessionId)
Runs this task immediately in to the
BatchTaskExecutor. |
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, submitexecuteSubTask, getServerContextawaitFinished, 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, wasSucceededcheckCancelled, 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, wasCancelledgetApplicationContext, getLogChannel, isLogDebug, isLogVerbose, logDebug, logDump, logError, logError, logFatal, logInfo, logVerbose, logWarning, setLogChannelconfigureDumpHeadlineLength, configureDumpMaxElementsPrinted, copyDumpStringValues, copyToStringValues, createDumpHeader, toDumpString, toDumpString, toStringclone, finalize, getClass, 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, toStringgetServerContextpublic AbstractBatchTask(S serverCtx, BatchTaskConfigEntry cfgEntry)
protected TaskMonitor createTaskMonitor()
createTaskMonitor in class AbstractRemoteTask<S extends ServerContext>protected java.util.concurrent.ScheduledFuture getCurrentFuture()
AbstractAsyncTaskFuture of this task as returned by the thread-pool.getCurrentFuture in class AbstractAsyncTask<S extends ServerContext>public BatchTaskConfigEntry getProcessConfigEntry()
public void setConfigEntry(BatchTaskConfigEntry newProcCfg)
public DatabaseConnection selectDataSource(java.lang.String dataSourceName) throws InvalidDataSourceException, ResourceLockedException, PermissionException
public DatabaseConnection resetToDefaultDataSource() throws InvalidDataSourceException, ResourceLockedException, PermissionException
public DatabaseConnection resetToPreviousDataSource() throws InvalidDataSourceException, ResourceLockedException, PermissionException
public ResourceLock lockDataSource(java.lang.String dataSourceName) throws java.lang.Exception
java.lang.Exceptionpublic void releaseLock(ResourceLock lock) throws NotLockOwnerException
NotLockOwnerExceptionpublic void notifyProgress(int step,
int maxSteps,
java.lang.String message)
public void notifyProgress(java.lang.String message)
protected void doOnStart()
throws java.lang.Exception
AbstractAsyncTaskdoOnStart in class AbstractAsyncTask<S extends ServerContext>java.lang.Exceptionprotected void doOnCancel()
AbstractAsyncExecutabledoOnCancel in class AbstractAsyncExecutable<S extends ServerContext>protected void doOnFinish()
AbstractAsyncTaskdoOnFinish in class AbstractAsyncTask<S extends ServerContext>public RemoteTaskId submitForDirectExecution(SessionId sessionId) throws java.lang.Exception
BatchTaskExecutor.
Note that this task runs ONLY ONCE and is NOT scheduled for later execution.sessionId - the current task ownerjava.lang.Exceptionpublic void submitForScheduledExecution()
public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic ToString toString(ToString s)
DumpabletoString in interface DumpabletoString in class AbstractAsyncTask<S extends ServerContext>Copyright © 2014 EsprIT-Systems. All Rights Reserved.