Class ResultAction
java.lang.Object
com.inet.taskplanner.server.api.action.ResultAction
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidexecuteAction(List<JobResultContainer> results, ProgressEventListener listener) Performs the action for the given results.protected abstract voidhandle(List<JobResultContainer> results) Handle the given results.protected voidsetProgress(int progress) Sets the progress of thisResultActionand propagates it to theProgressEventListener, if any.voidThis method is called by the task executor when it is requested to stop or cancel.
-
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 fromjobswhich this action must process. Can be empty when this action supports theNONEflavor or itsExecutionQualificationis set toALWAYS.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
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 itsExecutionQualificationis set toALWAYS.- 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 when it is requested to stop or cancel. Implementations should stop thehandle(List)method within 30 seconds; otherwise the thread is regarded as dead and aThread.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
-