de.esprit.netsuite.server.core

## Class ServerTaskManager

- java.lang.Object
- - de.esprit.common.util.DumpableObject
  - - de.esprit.appsuite.launch.AbstractApplicationObject<C>
    - - de.esprit.appsuite.task.taskmgr.TaskManager<ServerContext>
      - - de.esprit.netsuite.server.core.ServerTaskManager

- All Implemented Interfaces:
    ApplicationObject<ServerContext>, CloseableComponent, SimpleLogSupport, Dumpable, JournalTaskRestarter<ServerContext>, JournalTaskSupport, ServerObject<ServerContext>, java.lang.AutoCloseable

      public final class ServerTaskManager
      extends TaskManager<ServerContext>
      implements ServerObject<ServerContext>, JournalTaskRestarter<ServerContext>, JournalTaskSupport

  This class adds support for canceling running `RemoteCancellableTask` instances
  Author:
    Rainer Buesch

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ServerTaskManager(ServerContext serverCtx)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `cancelAllTasksOf(SessionId sessId)` Cancels all tasks of this session - except `JournalTask` instances.
    `boolean` | `cancelRemoteTask(RemoteTaskId taskId, SessionId killerId)`
    `void` | `checkJournalTaskAlreadyRunning(java.lang.String taskName)` Note that `JournalTask`s are recognized by name.
    `void` | `deregisterJournalTask(java.lang.String taskName)`
    `void` | `deregisterTask(AsyncTask task)`
    `void` | `doAfterJournalTaskRestart(java.lang.String serverName)` Is called after all remote journal tasks have been reattached
    `void` | `doBeforeJournalTaskRestart(java.lang.String serverName)` Is called before the attempt to reattach to any remote journal tasks
    `JournalTaskId[]` | `findJournalTaskIds()`
    `JournalTaskId[]` | `findJournalTasksOnCoServers(java.lang.String... coServerNames)` Finds all currently running journal tasks on the given coServers.
    `java.util.List<RemoteTaskId>` | `findRemoteTaskIds()` Returns the TaskIds of all currently running `RemoteTask`s except those with `JournalTaskId`s.
    `AsyncTask` | `findTaskByName(java.lang.String taskName)`
    `JournalTaskRestarter<ServerContext>` | `getJournalTaskRestarter()`
    `java.util.List<RemoteRunStateFlag>` | `getLastReceivedRemoteRunStateFlags()`
    `ParallelStreamsList` | `getParallelStreamsList()`
    `ParallelTransfersList` | `getParallelTransfersList()`
    `ServerContext` | `getServerContext()` Returns the server runtime environment
    `TaskHistoryWriter` | `getTaskHistoryWriter()`
    `AsyncTask` | `reattachToJournalTask(java.lang.String serverName, JournalTaskId taskId)` Is called for each remote journal task that has to be reattached.
    `void` | `registerForProgressEventsOnTask(SessionId sessionId, TaskId myTaskId, boolean doRegister)`
    `void` | `registerTask(AsyncTask task)`
    `void` | `setJournalTaskRestarter(JournalTaskRestarter<ServerContext> journalTaskRestarter)`

    - ### Methods inherited from class de.esprit.appsuite.task.taskmgr.TaskManager

      `cancelAll, cancelTask, checkForActivity, close, fillCurrentActivity, findAllCancellableTaskIds, findAllNonCancellableTaskIds, findTask, getActiveOsProcessesListModel, getActiveTasksListModel, getActiveWorkflowsListModel, getAsyncExecutor, getTaskCount, registerTaskStateChange`

    - ### 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, toString`

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

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

- - ### Constructor Detail

    - #### ServerTaskManager

          public ServerTaskManager(ServerContext serverCtx)

  - ### Method Detail

    - #### getTaskHistoryWriter

          public TaskHistoryWriter getTaskHistoryWriter()

    - #### getParallelTransfersList

          public final ParallelTransfersList getParallelTransfersList()

    - #### getParallelStreamsList

          public final ParallelStreamsList getParallelStreamsList()

    - #### getServerContext

          public final ServerContext getServerContext()

      Description copied from interface: `ServerObject`
      Returns the server runtime environment
      Specified by:
        `getServerContext` in interface `ServerObject<ServerContext>`

    - #### cancelRemoteTask

          public boolean cancelRemoteTask(RemoteTaskId taskId,
                                 SessionId killerId)

    - #### findRemoteTaskIds

          public java.util.List<RemoteTaskId> findRemoteTaskIds()

      Returns the TaskIds of all currently running `RemoteTask`s except those with `JournalTaskId`s.

    - #### getLastReceivedRemoteRunStateFlags

          public java.util.List<RemoteRunStateFlag> getLastReceivedRemoteRunStateFlags()

    - #### registerForProgressEventsOnTask

          public void registerForProgressEventsOnTask(SessionId sessionId,
                                             TaskId myTaskId,
                                             boolean doRegister)
                                               throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### registerTask

          public void registerTask(AsyncTask task)

      Overrides:
        `registerTask` in class `TaskManager<ServerContext>`

    - #### deregisterTask

          public void deregisterTask(AsyncTask task)

      Overrides:
        `deregisterTask` in class `TaskManager<ServerContext>`

    - #### findTaskByName

          public AsyncTask findTaskByName(java.lang.String taskName)

      Overrides:
        `findTaskByName` in class `TaskManager<ServerContext>`

    - #### findJournalTaskIds

          public JournalTaskId[] findJournalTaskIds()

    - #### deregisterJournalTask

          public void deregisterJournalTask(java.lang.String taskName)
                                     throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### cancelAllTasksOf

          public int cancelAllTasksOf(SessionId sessId)

      Cancels all tasks of this session - except `JournalTask` instances.

    - #### checkJournalTaskAlreadyRunning

          public void checkJournalTaskAlreadyRunning(java.lang.String taskName)

      Note that `JournalTask`s are recognized by name. Therefore it is not allowed to run two equally named tasks at the same time.

    - #### setJournalTaskRestarter

          public void setJournalTaskRestarter(JournalTaskRestarter<ServerContext> journalTaskRestarter)

    - #### getJournalTaskRestarter

          public JournalTaskRestarter<ServerContext> getJournalTaskRestarter()

    - #### doBeforeJournalTaskRestart

          public void doBeforeJournalTaskRestart(java.lang.String serverName)

      Description copied from interface: `JournalTaskRestarter`
      Is called before the attempt to reattach to any remote journal tasks
      Specified by:
        `doBeforeJournalTaskRestart` in interface `JournalTaskRestarter<ServerContext>`

    - #### reattachToJournalTask

          public AsyncTask reattachToJournalTask(java.lang.String serverName,
                                        JournalTaskId taskId)
                                          throws java.lang.Exception

      Description copied from interface: `JournalTaskRestarter`
      Is called for each remote journal task that has to be reattached.
      Specified by:
        `reattachToJournalTask` in interface `JournalTaskRestarter<ServerContext>`
      Throws:
        `java.lang.Exception`

    - #### doAfterJournalTaskRestart

          public void doAfterJournalTaskRestart(java.lang.String serverName)

      Description copied from interface: `JournalTaskRestarter`
      Is called after all remote journal tasks have been reattached
      Specified by:
        `doAfterJournalTaskRestart` in interface `JournalTaskRestarter<ServerContext>`

    - #### findJournalTasksOnCoServers

          public JournalTaskId[] findJournalTasksOnCoServers(java.lang.String... coServerNames)

      Description copied from interface: `JournalTaskSupport`
      Finds all currently running journal tasks on the given coServers.
      Specified by:
        `findJournalTasksOnCoServers` in interface `JournalTaskSupport`

Copyright © 2014 EsprIT-Systems. All Rights Reserved.