Class CpsThread

java.lang.Object
org.jenkinsci.plugins.workflow.cps.CpsThread
All Implemented Interfaces:
Serializable

public final class CpsThread extends Object implements Serializable
Represents a Continuable that is either runnable or suspended (that waits for an external event.)
Author:
Kohsuke Kawaguchi
See Also:
  • Field Details

    • id

      public final int id
      Unique ID of this thread among all the threads in the past or future under the same CpsThreadGroup. This acts as a persistable handle for CpsStepContext to refer back to the thread, because they are persisted separately.
  • Method Details

    • 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 of StepExecution, call StepExecution.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()
      While CpsThreadGroup executes, this method returns CpsThread that's running.
    • toString

      public String toString()
      Overrides:
      toString in class Object