Class SharedTaskContext

  • public class SharedTaskContext
    extends Object
    The strategy is used by the TimeoutGuardTask to stop a running guarded task.

    This class is called shared since it is shared by the guarded task and the guard task in order to communicate the task abort strategy.

    Rutger Lubbers, Paul Klos
    • Method Detail

      • setTaskRemoveStrategy

        public void setTaskRemoveStrategy​(TaskRemoveStrategy taskRemoveStrategy)
        Register the task removal strategy.
        taskRemoveStrategy - The TaskRemoveStrategy to share.
      • setTimeoutGuardTaskRemoveStrategy

        public void setTimeoutGuardTaskRemoveStrategy​(TaskRemoveStrategy timeoutGuardTaskRemoveStrategy)
        Register the timeout guard task removal strategy.
        timeoutGuardTaskRemoveStrategy - the TaskRemoveStrategy to set.
      • setTaskAbortStrategy

        public void setTaskAbortStrategy​(TaskAbortStrategy taskAbortStrategy)
        Register the task abort strategy.
        taskAbortStrategy - The TaskAbortStrategy to share.
      • abortBusinessTask

        public void abortBusinessTask()
        Invoke the taskAbortStrategy.
      • getTaskId

        public String getTaskId()
        Get the task's id.
        The task's id.
      • getTaskName

        public String getTaskName()
        Retrieve the task's name.
        The task's name.
      • isAborted

        public boolean isAborted()
        Has the task been aborted?
      • timeout

        public void timeout()
        Remove the guarded task from the queue, or else abort the running guarded task.
      • startExecution

        public void startExecution()
        Signal the start of the task's execution.
      • finish

        public void finish()
        This method is invoked when the guarded task is finished.

        It will perform cleanups. The finish should always be invoked.

      • getTaskStatistics

        public TaskStatistics getTaskStatistics()
        Return the task's execution statistics.