Class ResultAction
- java.lang.Object
-
- com.inet.taskplanner.server.api.action.ResultAction
-
public abstract class ResultAction extends java.lang.ObjectPerforms some action after the jobs.ResultActionDefinition---->ResultActionFactory----> ResultActionTypically 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
actionswhich do not require anyResultlike theNextTaskResultAction.- Since:
- taskplanner 3.0
-
-
Constructor Summary
Constructors Constructor Description ResultAction()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidexecuteAction(java.util.List<JobResultContainer> results, ProgressEventListener listener)Performs the action for the given results.protected abstract voidhandle(java.util.List<JobResultContainer> results)Handle the given results.protected voidsetProgress(int progress)Sets the progress of thisResultActionand propagates it to theProgressEventListener, if any.voidstopRequested()This method is called by the task executor in case the executor was requested to stop/cancel.
-
-
-
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 fromjobswhich this action must process. Can be empty when this action supports theNONEflavor or theExecutionQualificationwas set toALWAYSorNONE.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 (furtherResultActionwill 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 fromjobswhich this action must process. Can be empty when this action supports theNONEflavor or theExecutionQualificationwas set toALWAYSorNONE.- 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 (furtherResultActionwill be executed if any).- Since:
- taskplanner 3.0
-
setProgress
protected void setProgress(int progress)
Sets the progress of thisResultActionand propagates it to theProgressEventListener, 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 thehandle(List)method within 30 seconds, otherwise the thread will be regarded as 'dead' and aThread.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
-
-