Class CpsThread
- java.lang.Object
-
- org.jenkinsci.plugins.workflow.cps.CpsThread
-
- All Implemented Interfaces:
Serializable
public final class CpsThread extends Object implements Serializable
Represents aContinuable
that is either runnable or suspended (that waits for an external event.)- Author:
- Kohsuke Kawaguchi
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description int
id
Unique ID of this thread among all the threads in the past or future under the sameCpsThreadGroup
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CpsThread
current()
WhileCpsThreadGroup
executes, this method returnsCpsThread
that's running.org.jenkinsci.plugins.workflow.cps.ContextVariableSet
getContextVariables()
CpsFlowExecution
getExecution()
CpsThreadGroup
getGroup()
List<StackTraceElement>
getStackTrace()
org.jenkinsci.plugins.workflow.steps.StepExecution
getStep()
Future<Object>
resume(Outcome v)
Schedules the execution of this thread from the last Continuable.suspend(Object) point.void
stop(Throwable t)
Stops the execution of this thread.String
toString()
-
-
-
Field Detail
-
id
public final int id
Unique ID of this thread among all the threads in the past or future under the sameCpsThreadGroup
. This acts as a persistable handle forCpsStepContext
to refer back to the thread, because they are persisted separately.
-
-
Method Detail
-
getGroup
public CpsThreadGroup getGroup()
-
getExecution
public CpsFlowExecution getExecution()
-
getContextVariables
public org.jenkinsci.plugins.workflow.cps.ContextVariableSet getContextVariables()
-
getStep
public org.jenkinsci.plugins.workflow.steps.StepExecution getStep()
-
resume
public Future<Object> resume(Outcome v)
Schedules the execution of this thread from the last Continuable.suspend(Object) point.- Returns:
- Future that promises the completion of the next
runNextChunk()
.
-
stop
public void stop(Throwable t)
Stops the execution of this thread. If it's paused to wait for the completion ofStepExecution
, callStepExecution.stop(Throwable)
to give it a chance to clean up.If the execution is not inside a step (meaning it's paused in a safe point), then have the CPS thread throw a given
Throwable
to break asap.
-
getStackTrace
public List<StackTraceElement> getStackTrace()
-
current
public static CpsThread current()
WhileCpsThreadGroup
executes, this method returnsCpsThread
that's running.
-
-