- Type Parameters:
T- the type of the return value (may be
- All Implemented Interfaces:
public abstract class SynchronousNonBlockingStepExecution<T> extends StepExecutionSimilar to
SynchronousStepExecution(it executes synchronously too) but it does not block the CPS VM thread.
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description
blocksRestart()Allows a step to indicate that
AsynchronousExecution.blocksRestart()should be true.
getStatus()May be overridden to provide specific information about what a step is currently doing, for diagnostic purposes.
StepExecutionis brought back into memory after restart.
protected abstract T
run()Meat of the execution.
start()Start execution of something and report the end result back to the given callback.
stop(Throwable cause)If the computation is going synchronously, try to cancel that.
Methods inherited from class org.jenkinsci.plugins.workflow.steps.StepExecution
applyAll, applyAll, getContext, getStatusBounded
protected SynchronousNonBlockingStepExecution(@NonNull StepContext context)
runMeat of the execution. When this method returns, a step execution is over.
public final boolean start() throws ExceptionStart execution of something and report the end result back to the given callback.
Arguments are passed when instantiating steps.
- Specified by:
- true if the execution of this step has synchronously completed before this method returns.
It is the callee's responsibility to set the return value via
FutureCallback.onFailure(Throwable). false if the asynchronous execution has started and that
StepContextwill be notified when the result comes in. (Note that the nature of asynchrony is such that it is possible for the
StepContextto be already notified before this method returns.)
Exception- if any exception is thrown,
Stepis assumed to have completed abnormally synchronously (as if
FutureCallback.onFailure(java.lang.Throwable)is called and the method returned true.)
stopIf the computation is going synchronously, try to cancel that.
public void onResume()Called when
StepExecutionis brought back into memory after restart. Convenient for re-establishing the polling.
Currently not permitted to throw exceptions, but may report errors via
@NonNull public String getStatus()May be overridden to provide specific information about what a step is currently doing, for diagnostic purposes. Typical format should be a short, lowercase phrase. It should not be localized as this is intended for use by developers as well as users. May include technical details about Jenkins internals if relevant.
- current status, or null if unimplemented
- See Also:
public boolean blocksRestart()Allows a step to indicate that
AsynchronousExecution.blocksRestart()should be true. Typically this would be true if
StepExecution.getStatus()indicates that the step is in the middle of something active, as opposed to waiting for an external event or a body to complete.
Note that activity in the CPS VM thread automatically blocks restart, so overriding this is only necessary for steps using a background thread, such as