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> T
boolean
protected CpsFlowExecution
protected org.jenkinsci.plugins.workflow.graph.FlowNode
getNode()
org.jenkinsci.plugins.workflow.steps.StepDescriptor
ObtainsStepDescriptor
that represents the step this context is invoking.boolean
hasBody()
int
hashCode()
boolean
isReady()
newBodyInvoker
(org.jenkinsci.plugins.workflow.cps.BodyReference body, boolean unexport) void
void
com.google.common.util.concurrent.ListenableFuture<Void>
void
toString()
Methods inherited from class org.jenkinsci.plugins.workflow.support.DefaultStepContext
get
-
Method Details
-
getStepDescriptor
@CheckForNull public org.jenkinsci.plugins.workflow.steps.StepDescriptor getStepDescriptor()ObtainsStepDescriptor
that 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:
getExecution
in classorg.jenkinsci.plugins.workflow.support.DefaultStepContext
- Throws:
IOException
-
isReady
public boolean isReady()- Specified by:
isReady
in classorg.jenkinsci.plugins.workflow.steps.StepContext
-
hasBody
public boolean hasBody()- Overrides:
hasBody
in classorg.jenkinsci.plugins.workflow.steps.StepContext
-
newBodyInvoker
- Specified by:
newBodyInvoker
in classorg.jenkinsci.plugins.workflow.steps.StepContext
-
newBodyInvoker
@NonNull public CpsBodyInvoker newBodyInvoker(@NonNull org.jenkinsci.plugins.workflow.cps.BodyReference body, boolean unexport) -
doGet
- Specified by:
doGet
in classorg.jenkinsci.plugins.workflow.support.DefaultStepContext
- Throws:
IOException
InterruptedException
-
getNode
- Specified by:
getNode
in classorg.jenkinsci.plugins.workflow.support.DefaultStepContext
- Throws:
IOException
-
onFailure
-
onSuccess
- Specified by:
onSuccess
in interfacecom.google.common.util.concurrent.FutureCallback<Object>
- Specified by:
onSuccess
in classorg.jenkinsci.plugins.workflow.steps.StepContext
-
setResult
- Specified by:
setResult
in classorg.jenkinsci.plugins.workflow.steps.StepContext
-
saveState
- Specified by:
saveState
in classorg.jenkinsci.plugins.workflow.steps.StepContext
-
equals
- Specified by:
equals
in classorg.jenkinsci.plugins.workflow.steps.StepContext
-
hashCode
public int hashCode()- Specified by:
hashCode
in classorg.jenkinsci.plugins.workflow.steps.StepContext
-
toString
-