public class CpsStepContext
extends org.jenkinsci.plugins.workflow.support.DefaultStepContext
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
}.
Step.start(StepContext)
,
Serialized FormModifier and Type | Method and Description |
---|---|
protected <T> T |
doGet(Class<T> key) |
boolean |
equals(Object o) |
String |
getDisplayName() |
protected CpsFlowExecution |
getExecution() |
protected org.jenkinsci.plugins.workflow.graph.FlowNode |
getNode() |
org.jenkinsci.plugins.workflow.steps.StepDescriptor |
getStepDescriptor()
Obtains
StepDescriptor that represents the step this context is invoking. |
boolean |
hasBody() |
int |
hashCode() |
boolean |
isReady() |
CpsBodyInvoker |
newBodyInvoker() |
CpsBodyInvoker |
newBodyInvoker(org.jenkinsci.plugins.workflow.cps.BodyReference body,
boolean unexport) |
void |
onFailure(Throwable t) |
void |
onSuccess(Object returnValue) |
com.google.common.util.concurrent.ListenableFuture<Void> |
saveState() |
void |
setResult(Result r) |
String |
toString() |
@CheckForNull public org.jenkinsci.plugins.workflow.steps.StepDescriptor getStepDescriptor()
StepDescriptor
that represents the step this context is invoking.public String getDisplayName()
protected CpsFlowExecution getExecution() throws IOException
getExecution
in class org.jenkinsci.plugins.workflow.support.DefaultStepContext
IOException
public boolean isReady()
isReady
in class org.jenkinsci.plugins.workflow.steps.StepContext
public boolean hasBody()
hasBody
in class org.jenkinsci.plugins.workflow.steps.StepContext
public CpsBodyInvoker newBodyInvoker()
newBodyInvoker
in class org.jenkinsci.plugins.workflow.steps.StepContext
@Nonnull public CpsBodyInvoker newBodyInvoker(@Nonnull org.jenkinsci.plugins.workflow.cps.BodyReference body, boolean unexport)
protected <T> T doGet(Class<T> key) throws IOException, InterruptedException
doGet
in class org.jenkinsci.plugins.workflow.support.DefaultStepContext
IOException
InterruptedException
protected org.jenkinsci.plugins.workflow.graph.FlowNode getNode() throws IOException
getNode
in class org.jenkinsci.plugins.workflow.support.DefaultStepContext
IOException
public void onFailure(Throwable t)
public void onSuccess(Object returnValue)
onSuccess
in interface com.google.common.util.concurrent.FutureCallback<Object>
onSuccess
in class org.jenkinsci.plugins.workflow.steps.StepContext
public void setResult(Result r)
setResult
in class org.jenkinsci.plugins.workflow.steps.StepContext
public com.google.common.util.concurrent.ListenableFuture<Void> saveState()
saveState
in class org.jenkinsci.plugins.workflow.steps.StepContext
public boolean equals(Object o)
equals
in class org.jenkinsci.plugins.workflow.steps.StepContext
public int hashCode()
hashCode
in class org.jenkinsci.plugins.workflow.steps.StepContext
Copyright © 2016–2020. All rights reserved.