Interface TaskExecutionResult
- All Known Implementing Classes:
TaskExecutionResult.AwaitSignal,TaskExecutionResult.Completed,TaskExecutionResult.Failed,TaskExecutionResult.SuspendFor
TaskExecutorExtension.execute(com.xebialabs.xlrelease.osgi.api.tasks.TaskExecutionContext) returns.
A closed set of four outcomes, created through the static factory methods. Suspension is
always a returned outcome, never a blocked or parked thread - the host persists the
task's state and re-enters execute later, which is what makes a wait survive a server
restart.
The two suspending outcomes mirror the two mechanisms Jython tasks already have:
suspendFor(Duration) corresponds to CustomScriptTask.schedule(path, interval),
and awaitSignal() to waitForSignal(). In both cases the task stays in progress
and execute is entered again from the top - there is no separate "resume" method to
implement. Distinguish the entries with TaskExecutionContext.isResume() and carry state
across the gap in output properties.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordThe task should be re-entered only when something external signals it.static final recordThe task finished successfully.static final recordThe task failed.static final recordThe task should be re-entered afterdelay. -
Method Summary
Static MethodsModifier and TypeMethodDescriptionstatic TaskExecutionResultSuspend indefinitely, until something external resumes the task.static TaskExecutionResultThe task finished successfully.static TaskExecutionResultThe task failed, with a message for the release author.static TaskExecutionResultsuspendFor(Duration delay) Suspend, and re-enterTaskExecutorExtension.execute(com.xebialabs.xlrelease.osgi.api.tasks.TaskExecutionContext)afterdelay.
-
Method Details
-
completed
The task finished successfully. -
failed
The task failed, with a message for the release author.- Parameters:
message- non-blank; what went wrong and ideally what to do about it- Throws:
IllegalArgumentException- ifmessageisnullor blank - a failure the author cannot read is worse than a stack trace
-
suspendFor
Suspend, and re-enterTaskExecutorExtension.execute(com.xebialabs.xlrelease.osgi.api.tasks.TaskExecutionContext)afterdelay.State is not kept in memory across the gap - persist anything you need through
TaskExecutionContext.setOutputProperty(String, Object)and read it back on the next entry.- Parameters:
delay- at least one second, matching the lower bound Jython'sCustomScriptTask.schedule(String, Integer)enforces on its interval- Throws:
IllegalArgumentException- ifdelayisnull, or shorter than a second
-
awaitSignal
Suspend indefinitely, until something external resumes the task.- See Also:
-