Class CpsStepContext
- All Implemented Interfaces:
com.google.common.util.concurrent.FutureCallback<Object>,Serializable
StepContext implementation for CPS.
This context behaves in two modes. It starts in the synchronous mode, where if a result is set (or exception
is thrown), it just gets recoded. When passed into Step.start(StepContext), it's in this mode.
When Step.start(StepContext) method returns, we'll atomically check if the result is set or not
and then switch to the asynchronous mode. In this mode, if the result is set, it'll trigger the rehydration
of the workflow. If a CpsStepContext gets serialized, it'll be deserialized in the asynchronous mode.
This object must be serializable on its own without sucking in any of the CpsFlowExecution object
graph. Wherever we need CpsFlowExecution we do that by following FlowExecutionOwner, and
when we need pointers to individual objects inside, we use IDs (such as id}.
- Author:
- Kohsuke Kawaguchi
- See Also:
-
Step.start(StepContext)- Serialized Form
-
Method Summary
Modifier and TypeMethodDescriptionprotected <T> Tbooleanprotected CpsFlowExecutionprotected org.jenkinsci.plugins.workflow.graph.FlowNodegetNode()org.jenkinsci.plugins.workflow.steps.StepDescriptorObtainsStepDescriptorthat represents the step this context is invoking.booleanhasBody()inthashCode()booleanisReady()newBodyInvoker(org.jenkinsci.plugins.workflow.cps.BodyReference body, boolean unexport) voidvoidcom.google.common.util.concurrent.ListenableFuture<Void>voidtoString()Methods inherited from class org.jenkinsci.plugins.workflow.support.DefaultStepContext
get
-
Method Details
-
getStepDescriptor
@CheckForNull public org.jenkinsci.plugins.workflow.steps.StepDescriptor getStepDescriptor()ObtainsStepDescriptorthat represents the step this context is invoking.- Returns:
- This method returns null if the step descriptor used is not recoverable in the current VM session, such as when the plugin that implements this was removed. So the caller should defend against null.
-
getDisplayName
-
getExecution
- Specified by:
getExecutionin classorg.jenkinsci.plugins.workflow.support.DefaultStepContext- Throws:
IOException
-
isReady
public boolean isReady()- Specified by:
isReadyin classorg.jenkinsci.plugins.workflow.steps.StepContext
-
hasBody
public boolean hasBody()- Overrides:
hasBodyin classorg.jenkinsci.plugins.workflow.steps.StepContext
-
newBodyInvoker
- Specified by:
newBodyInvokerin classorg.jenkinsci.plugins.workflow.steps.StepContext
-
newBodyInvoker
@NonNull public CpsBodyInvoker newBodyInvoker(@NonNull org.jenkinsci.plugins.workflow.cps.BodyReference body, boolean unexport) -
doGet
- Specified by:
doGetin classorg.jenkinsci.plugins.workflow.support.DefaultStepContext- Throws:
IOExceptionInterruptedException
-
getNode
- Specified by:
getNodein classorg.jenkinsci.plugins.workflow.support.DefaultStepContext- Throws:
IOException
-
onFailure
-
onSuccess
- Specified by:
onSuccessin interfacecom.google.common.util.concurrent.FutureCallback<Object>- Specified by:
onSuccessin classorg.jenkinsci.plugins.workflow.steps.StepContext
-
setResult
- Specified by:
setResultin classorg.jenkinsci.plugins.workflow.steps.StepContext
-
saveState
- Specified by:
saveStatein classorg.jenkinsci.plugins.workflow.steps.StepContext
-
equals
- Specified by:
equalsin classorg.jenkinsci.plugins.workflow.steps.StepContext
-
hashCode
public int hashCode()- Specified by:
hashCodein classorg.jenkinsci.plugins.workflow.steps.StepContext
-
toString
-