de.esprit.netsuite.rtask.journal

## Class AbstractJournalTask<S extends ServerContext>

- java.lang.Object
- - de.esprit.common.util.DumpableObject
  - - de.esprit.appsuite.launch.AbstractApplicationObject<C>
    - - de.esprit.appsuite.task.AbstractAsyncExecutable<C>
      - - de.esprit.appsuite.task.AbstractAsyncTask<S>
        - - de.esprit.netsuite.rtask.AbstractServerTask<S>
          - - de.esprit.netsuite.rtask.AbstractRemoteTask<S>
            - - de.esprit.netsuite.rtask.journal.AbstractJournalTask<S>

- All Implemented Interfaces:
    ApplicationObject<S>, AsyncExecutable<S>, AsyncTask<S>, CancellableTask, LocalCancellableTask, TaskMonitorSupport, TaskIdHolder, SimpleLogSupport, Dumpable, Executable, JournalTask<S>, RemoteCancellableTask, RemoteTask<S>, ServerObject<S>, java.lang.Runnable

      public abstract class AbstractJournalTask<S extends ServerContext>
      extends AbstractRemoteTask<S>
      implements JournalTask<S>

  This is the base class for all journal remote tasks. Unlike a normal `RemoteTask` a `JournalTask` continues running on the server after a client disconnect. On client reconnect the task is reattached to the client and will run under client control as before. In order to make this possible the journal task stores it's `RemoteTaskEvent`s in a `JournalTaskMonitor` and replays them on a client reconnect.
  Author:
    Thomas Stecher, Rainer Buesch

- - ### Field Summary

    - ### Fields inherited from class de.esprit.appsuite.task.AbstractAsyncExecutable

      `childTaskRef, isTestMode, monitorController, resultRef, stateFlag`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractJournalTask(S serverCtx, LogChannel logCh, RemoteTaskType taskType, SessionId sessionId)`
    `AbstractJournalTask(S serverCtx, LogChannel logCh, java.lang.String taskName, RemoteTaskType taskType, SessionId sessionId)`
    `AbstractJournalTask(S serverCtx, SessionId sessionId)`
    `AbstractJournalTask(S serverCtx, java.lang.String taskName, RemoteTaskType taskType, SessionId sessionId)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `attachAndPlayEventJournal(SessionId sessionId)` Re-attaches to the `JournalTask` and forces it to sent all stored and future events to the given session.
    `protected JournalTaskId` | `createTaskId()` Is called at submit time.
    `protected JournalTaskMonitor` | `createTaskMonitor()`
    `JournalTaskMonitor` | `getJournalMonitor()`
    `JournalTaskId` | `getTaskId()` Returns an identifier object for this task.
    `JournalTaskId` | `submit()` Submits this task for execution to the default application thread pool
    `JournalTaskId` | `submit(java.util.concurrent.ExecutorService pool)` Submits this task for execution to the given thread pool

    - ### Methods inherited from class de.esprit.netsuite.rtask.AbstractRemoteTask

      `addMonitor, cancel, createRunStateFlag, getKillerSessionId, getOwnerSessionId, getRunStateFlag, getSessionId, setSessionId`

    - ### Methods inherited from class de.esprit.netsuite.rtask.AbstractServerTask

      `executeSubTask, getServerContext`

    - ### Methods inherited from class de.esprit.appsuite.task.AbstractAsyncTask

      `awaitFinished, 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, wasSucceeded`

    - ### Methods inherited from class de.esprit.appsuite.task.AbstractAsyncExecutable

      `checkCancelled, 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, wasCancelled`

    - ### Methods inherited from class de.esprit.appsuite.launch.AbstractApplicationObject

      `getApplicationContext, getLogChannel, isLogDebug, isLogVerbose, logDebug, logDump, logError, logError, logFatal, logInfo, logVerbose, logWarning, setLogChannel`

    - ### Methods inherited from class de.esprit.common.util.DumpableObject

      `configureDumpHeadlineLength, configureDumpMaxElementsPrinted, copyDumpStringValues, copyToStringValues, createDumpHeader, toDumpString, toDumpString, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface de.esprit.netsuite.rtask.journal.JournalTask

      `setSessionId`

    - ### Methods inherited from interface de.esprit.netsuite.rtask.RemoteTask

      `getOwnerSessionId, getRunStateFlag, getSessionId`

    - ### Methods inherited from interface de.esprit.appsuite.task.AsyncTask

      `awaitFinished, awaitFinished, awaitStarted, executeChildTask, executeChildTask, getError, getProcessingDuration, hasError, isRegisterForCancel, isRunning, releaseStart, setName, setReleaseTimeout`

    - ### Methods inherited from interface de.esprit.appsuite.task.AsyncExecutable

      `checkCancelled, checkForErrorAndRethrow, executeAsync, executeSubTask, getName, getResult, getType, handleCancellation, handleFailure, isCancellable, notifyProceeded, setCancellable, setName, setResult, setRunStateFlag, sleepChecked`

    - ### Methods inherited from interface de.esprit.appsuite.launch.ApplicationObject

      `getApplicationContext`

    - ### Methods inherited from interface de.esprit.common.type.Executable

      `execute`

    - ### Methods inherited from interface de.esprit.appsuite.task.monitor.TaskMonitorSupport

      `addMonitor, clearMonitors, getMonitorCount, getMonitors, hasMonitor, removeMonitor`

    - ### Methods inherited from interface de.esprit.common.log.SimpleLogSupport

      `getLogChannel, isLogDebug, isLogVerbose, logDebug, logDump, logError, logError, logFatal, logInfo, logVerbose, logWarning, setLogChannel`

    - ### Methods inherited from interface java.lang.Runnable

      `run`

    - ### Methods inherited from interface de.esprit.appsuite.task.LocalCancellableTask

      `cancel`

    - ### Methods inherited from interface de.esprit.appsuite.task.CancellableTask

      `wasCancelled`

    - ### Methods inherited from interface de.esprit.common.type.Dumpable

      `toDumpString, toDumpString, toString, toString`

    - ### Methods inherited from interface de.esprit.netsuite.server.ServerObject

      `getServerContext`

    - ### Methods inherited from interface de.esprit.netsuite.rtask.RemoteCancellableTask

      `cancel, getKillerSessionId`

- - ### Constructor Detail

    - #### AbstractJournalTask

          public AbstractJournalTask(S serverCtx,
                             LogChannel logCh,
                             RemoteTaskType taskType,
                             SessionId sessionId)

    - #### AbstractJournalTask

          public AbstractJournalTask(S serverCtx,
                             LogChannel logCh,
                             java.lang.String taskName,
                             RemoteTaskType taskType,
                             SessionId sessionId)

    - #### AbstractJournalTask

          public AbstractJournalTask(S serverCtx,
                             java.lang.String taskName,
                             RemoteTaskType taskType,
                             SessionId sessionId)

    - #### AbstractJournalTask

          public AbstractJournalTask(S serverCtx,
                             SessionId sessionId)

  - ### Method Detail

    - #### submit

          public JournalTaskId submit(java.util.concurrent.ExecutorService pool)
                               throws java.lang.Exception

      Description copied from interface: `AsyncTask`
      Submits this task for execution to the given thread pool
      Specified by:
        `submit` in interface `AsyncTask<S extends ServerContext>`
      Specified by:
        `submit` in interface `RemoteTask<S extends ServerContext>`
      Overrides:
        `submit` in class `AbstractRemoteTask<S extends ServerContext>`
      Throws:
        `java.lang.Exception` - if the pool is busy

    - #### submit

          public JournalTaskId submit()
                               throws java.lang.Exception

      Description copied from interface: `AsyncTask`
      Submits this task for execution to the default application thread pool
      Specified by:
        `submit` in interface `AsyncTask<S extends ServerContext>`
      Specified by:
        `submit` in interface `RemoteTask<S extends ServerContext>`
      Overrides:
        `submit` in class `AbstractRemoteTask<S extends ServerContext>`
      Throws:
        `java.lang.Exception` - if the pool is busy

    - #### createTaskId

          protected final JournalTaskId createTaskId()

      Description copied from class: `AbstractAsyncTask`
      Is called at submit time. Each submit of a task creates a new `TaskId` which is added to the `RunStateFlag`.
      Overrides:
        `createTaskId` in class `AbstractRemoteTask<S extends ServerContext>`

    - #### getTaskId

          public JournalTaskId getTaskId()

      Description copied from interface: `AsyncExecutable`
      Returns an identifier object for this task. Note: The `TaskId` is used to model the task-hierarchy in a `RunStateFlag`. For `AsyncExecutable`s it's always an instance of `PseudoTaskId`.
      Specified by:
        `getTaskId` in interface `AsyncExecutable<S extends ServerContext>`
      Specified by:
        `getTaskId` in interface `TaskIdHolder`
      Specified by:
        `getTaskId` in interface `JournalTask<S extends ServerContext>`
      Specified by:
        `getTaskId` in interface `RemoteTask<S extends ServerContext>`
      Overrides:
        `getTaskId` in class `AbstractRemoteTask<S extends ServerContext>`

    - #### createTaskMonitor

          protected final JournalTaskMonitor createTaskMonitor()

      Overrides:
        `createTaskMonitor` in class `AbstractRemoteTask<S extends ServerContext>`

    - #### getJournalMonitor

          public final JournalTaskMonitor getJournalMonitor()

      Specified by:
        `getJournalMonitor` in interface `JournalTask<S extends ServerContext>`

    - #### attachAndPlayEventJournal

          public final void attachAndPlayEventJournal(SessionId sessionId)

      Description copied from interface: `JournalTask`
      Re-attaches to the `JournalTask` and forces it to sent all stored and future events to the given session.
      Specified by:
        `attachAndPlayEventJournal` in interface `JournalTask<S extends ServerContext>`

Copyright © 2014 EsprIT-Systems. All Rights Reserved.