Class ResultAction

java.lang.Object
com.inet.taskplanner.server.api.action.ResultAction

public abstract class ResultAction extends Object
Performs some action after the jobs.

          ResultActionDefinition ----> ResultActionFactory ----> ResultAction

Typically this does something with the results of jobs, like transporting files or messages to external systems like mail servers or file archives. There are also actions which do not require any Result like the NextTaskResultAction.

Since:
taskplanner 3.0
  • Constructor Details

    • ResultAction

      public ResultAction()
  • Method Details

    • executeAction

      public final void executeAction(List<JobResultContainer> results, ProgressEventListener listener) throws TaskExecutionException
      Performs the action for the given results. Throwing exceptions will not break/stop the task.
      Parameters:
      results - the results from jobs which this action must process. Can be empty when this action supports the NONE flavor or its ExecutionQualification is set to ALWAYS.
      listener - the progress listener to notify in case of progress updates
      Throws:
      TaskExecutionException - if this action faces an unexpected error where it cannot continue handling. This error will appear in the task's execution history, but it will not break the task (further ResultAction will be executed if any).
      Since:
      taskplanner 3.0
    • handle

      protected abstract void handle(List<JobResultContainer> results) throws TaskExecutionException
      Handle the given results. Throwing exceptions will not break/stop the task.
      Parameters:
      results - the results from jobs which this action must process. Can be empty when this action supports the NONE flavor or its ExecutionQualification is set to ALWAYS.
      Throws:
      TaskExecutionException - if this action faces an unexpected error where it cannot continue handling. This error will appear in the task's execution history, but it will not break the task (further ResultAction will be executed if any).
      Since:
      taskplanner 3.0
    • setProgress

      protected void setProgress(int progress)
      Sets the progress of this ResultAction and propagates it to the ProgressEventListener, if any.
      Parameters:
      progress - the progress to be set. Will be bounded to [0..100]
      Since:
      taskplanner 3.0
    • stopRequested

      public void stopRequested()
      This method is called by the task executor when it is requested to stop or cancel. Implementations should stop the handle(List) method within 30 seconds; otherwise the thread is regarded as dead and a Thread.stop() might be invoked by the caller to ensure termination.
      By default this method does nothing since it's assumed that most jobs will finish within 30 seconds either way.
      Since:
      taskplanner 3.0