Class RootWorkflowThreadImpl

    • Method Detail

      • run

        public void run()
        Specified by:
        run in interface java.lang.Runnable
      • cancel

        public void cancel​(java.lang.String reason)
        Description copied from interface: CancellationScope
        Cancels the scope as well as all its children.
        Specified by:
        cancel in interface CancellationScope
        Parameters:
        reason - human-readable reason for the cancellation. Becomes message of the CanceledException thrown.
      • getCancellationRequest

        public Promise<java.lang.String> getCancellationRequest()
        Description copied from interface: CancellationScope
        Use this promise to perform cancellation of async operations.
        Specified by:
        getCancellationRequest in interface CancellationScope
        Returns:
        promise that becomes ready when scope is canceled. It contains reason value or null if none was provided.
      • getRunner

        public io.temporal.internal.sync.DeterministicRunnerImpl getRunner()
        Specified by:
        getRunner in interface WorkflowThread
      • setName

        public void setName​(java.lang.String name)
        Specified by:
        setName in interface WorkflowThread
      • runUntilBlocked

        public boolean runUntilBlocked​(long deadlockDetectionTimeoutMs)
        Specified by:
        runUntilBlocked in interface WorkflowThread
        Parameters:
        deadlockDetectionTimeoutMs - maximum time in milliseconds the thread can run before calling yield.
        Returns:
        true if coroutine made some progress.
      • evaluateInCoroutineContext

        public void evaluateInCoroutineContext​(Functions.Proc1<java.lang.String> function)
        Evaluates function in the threadContext of the coroutine without unblocking it. Used to get current coroutine status, like stack trace.
        Parameters:
        function - Parameter is reason for current goroutine blockage.
      • stopNow

        public java.util.concurrent.Future<?> stopNow()
        Interrupt coroutine by throwing DestroyWorkflowThreadError from an await method it is blocked on and return underlying Future to be waited on.
        Specified by:
        stopNow in interface WorkflowThread
      • addStackTrace

        public void addStackTrace​(java.lang.StringBuilder result)
        Specified by:
        addStackTrace in interface WorkflowThread
      • getThreadLocal

        public <T> java.util.Optional<java.util.Optional<T>> getThreadLocal​(WorkflowThreadLocalInternal<T> key)
        Retrieve data from thread locals. Returns 1. not found (an empty Optional) 2. found but null (an Optional of an empty Optional) 3. found and non-null (an Optional of an Optional of a value). The type nesting is because Java Optionals cannot understand "Some null" vs "None", which is exactly what we need here.
        Specified by:
        getThreadLocal in interface WorkflowThread
        Type Parameters:
        T -
        Parameters:
        key -
        Returns:
        one of three cases
      • getStackTrace

        public java.lang.String getStackTrace()
        Specified by:
        getStackTrace in interface WorkflowThread
        Returns:
        stack trace of the coroutine thread