T
- the type of the return value (may be Void
)public abstract class SynchronousNonBlockingStepExecution<T> extends StepExecution
SynchronousStepExecution
(it executes synchronously too) but it does not block the CPS VM thread.StepExecution
,
Serialized FormModifier | Constructor and Description |
---|---|
protected |
SynchronousNonBlockingStepExecution(StepContext context) |
Modifier and Type | Method and Description |
---|---|
String |
getStatus()
May be overridden to provide specific information about what a step is currently doing, for diagnostic purposes.
|
void |
onResume()
Called when
StepExecution is brought back into memory after restart. |
protected abstract T |
run()
Meat of the execution.
|
boolean |
start()
Start execution of something and report the end result back to the given callback.
|
void |
stop(Throwable cause)
If the computation is going synchronously, try to cancel that.
|
applyAll, applyAll, getContext, getStatusBounded, toString
protected SynchronousNonBlockingStepExecution(@Nonnull StepContext context)
protected abstract T run() throws Exception
Exception
public final boolean start() throws Exception
StepExecution
start
in class StepExecution
StepContext.onSuccess(Object)
or FutureCallback.onFailure(Throwable)
.
false if the asynchronous execution has started and that StepContext
will be notified when the result comes in. (Note that the nature of asynchrony is such that it is possible
for the StepContext
to be already notified before this method returns.)Exception
- if any exception is thrown, Step
is assumed to have completed abnormally synchronously
(as if FutureCallback.onFailure(java.lang.Throwable)
is called and the method returned true.)public void stop(Throwable cause) throws Exception
stop
in class StepExecution
cause
- Contextual information that lets the step know what resulted in stopping an executing step,
passed in the hope that this will assist diagnostics.Exception
public void onResume()
StepExecution
StepExecution
is brought back into memory after restart.
Convenient for re-establishing the polling.onResume
in class StepExecution
@Nonnull public String getStatus()
StepExecution
getStatus
in class StepExecution
StepExecution.getStatusBounded(long, java.util.concurrent.TimeUnit)
Copyright © 2016–2017. All rights reserved.