Class CpsThreadGroup
- java.lang.Object
-
- org.jenkinsci.plugins.workflow.cps.CpsThreadGroup
-
- All Implemented Interfaces:
Serializable
public final class CpsThreadGroup extends Object implements Serializable
List ofCpsThread
s that form a singleCpsFlowExecution
.To make checkpointing easy, only one
CpsThread
runs at any point in time.- Author:
- Kohsuke Kawaguchi
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description Map<Integer,groovy.lang.Closure>
closures
"Exported" closures that are referenced by liveCpsStepContext
s.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CpsThread
addThread(Continuable program, org.jenkinsci.plugins.workflow.cps.FlowHead head, org.jenkinsci.plugins.workflow.cps.ContextVariableSet contextVariables)
org.jenkinsci.plugins.workflow.cps.BodyReference
export(groovy.lang.Closure body)
org.jenkinsci.plugins.workflow.cps.BodyReference
export(groovy.lang.Script body)
CpsFlowExecution
getExecution()
CpsThread
getThread(int id)
Returns the thread with the specified id.CpsThreadDump
getThreadDump()
Iterable<CpsThread>
getThreads()
Returns an unmodifiable snapshot of all threads in the thread group.boolean
isPaused()
Returns true if pausing has been requested.Future<?>
pause(boolean persist)
Pauses the execution.void
saveProgram(File f)
Future<?>
scheduleRun()
Schedules the execution of all the runnable threads.void
unexport(org.jenkinsci.plugins.workflow.cps.BodyReference ref)
void
unpause()
If the execution isisPaused()
, cancel the pause state.
-
-
-
Field Detail
-
closures
public final Map<Integer,groovy.lang.Closure> closures
"Exported" closures that are referenced by liveCpsStepContext
s.
-
-
Method Detail
-
getExecution
public CpsFlowExecution getExecution()
-
addThread
public CpsThread addThread(@NonNull Continuable program, org.jenkinsci.plugins.workflow.cps.FlowHead head, org.jenkinsci.plugins.workflow.cps.ContextVariableSet contextVariables)
-
getThread
public CpsThread getThread(int id)
Returns the thread with the specified id. Normally called from the CPS VM thread, but may be called from other threads viaCpsStepContext.doGet(java.lang.Class<T>)
.- Returns:
- null if the thread has finished executing.
-
getThreads
public Iterable<CpsThread> getThreads()
Returns an unmodifiable snapshot of all threads in the thread group.
-
export
@NonNull public org.jenkinsci.plugins.workflow.cps.BodyReference export(@NonNull groovy.lang.Closure body)
-
export
@NonNull public org.jenkinsci.plugins.workflow.cps.BodyReference export(@NonNull groovy.lang.Script body)
-
unexport
public void unexport(org.jenkinsci.plugins.workflow.cps.BodyReference ref)
-
scheduleRun
public Future<?> scheduleRun()
Schedules the execution of all the runnable threads.- Returns:
Future
object that represents when the CPS VM is executed.
-
pause
public Future<?> pause(boolean persist)
Pauses the execution.- Parameters:
persist
- whether this is a user-initiated pause that should be persisted- Returns:
Future
object that represents the actual suspension of the CPS VM. When this method is called, the CPS VM might be still executing.
-
unpause
public void unpause()
If the execution isisPaused()
, cancel the pause state.
-
isPaused
public boolean isPaused()
Returns true if pausing has been requested.
-
getThreadDump
public CpsThreadDump getThreadDump()
-
saveProgram
public void saveProgram(File f) throws IOException
- Throws:
IOException
-
-