Class ResultAction
- java.lang.Object
-
- com.inet.taskplanner.server.api.action.ResultAction
-
public abstract class ResultAction extends java.lang.Object
Performs 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
actions
which do not require anyResult
like 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 void
executeAction(java.util.List<JobResultContainer> results, ProgressEventListener listener)
Performs the action for the given results.protected abstract void
handle(java.util.List<JobResultContainer> results)
Handle the given results.protected void
setProgress(int progress)
Sets the progress of thisResultAction
and propagates it to theProgressEventListener
, if any.void
stopRequested()
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 fromjobs
which this action must process. Can be empty when this action supports theNONE
flavor or theExecutionQualification
was set toALWAYS
orNONE
.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 (furtherResultAction
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 fromjobs
which this action must process. Can be empty when this action supports theNONE
flavor or theExecutionQualification
was set toALWAYS
orNONE
.- 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 (furtherResultAction
will be executed if any).- Since:
- taskplanner 3.0
-
setProgress
protected void setProgress(int progress)
Sets the progress of thisResultAction
and 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
-
-