Class ResultAction


  • public abstract class ResultAction
    extends java.lang.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 Detail

      • ResultAction

        public ResultAction()
    • Method Detail

      • executeAction

        public final void executeAction​(java.util.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 the ExecutionQualification was set to ALWAYS or NONE.
        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​(java.util.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 the ExecutionQualification was set to ALWAYS or NONE.
        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 in case the executor was requested to stop/cancel. It's supposed to stop the handle(List) method within 30 seconds, otherwise the thread will be regarded as 'dead' and a Thread.stop() might be invoked by the caller to ensure a 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