Class WorkflowThreadContext


  • public class WorkflowThreadContext
    extends java.lang.Object
    • Method Detail

      • initialYield

        public void initialYield()
      • yield

        public void yield​(java.lang.String reason,
                          java.util.function.Supplier<java.lang.Boolean> unblockFunction)
      • evaluateInCoroutineContext

        public void evaluateInCoroutineContext​(Functions.Proc1<java.lang.String> function)
        Call function by the thread that owns this context and is currently blocked in a await. Used to get information about current state of the thread like current stack trace.
        Parameters:
        function - to evaluate. Consumes reason for yielding as a parameter.
      • getStatus

        public io.temporal.internal.sync.Status getStatus()
      • setStatus

        public void setStatus​(io.temporal.internal.sync.Status status)
      • isDone

        public boolean isDone()
      • getUnhandledException

        public java.lang.Throwable getUnhandledException()
      • setUnhandledException

        public void setUnhandledException​(java.lang.Throwable unhandledException)
      • getYieldReason

        public java.lang.String getYieldReason()
      • runUntilBlocked

        public boolean runUntilBlocked​(long deadlockDetectionTimeoutMs)
        Parameters:
        deadlockDetectionTimeoutMs - maximum time in milliseconds the thread can run before calling yield. Discarded if TEMPORAL_DEBUG env variable is set.
        Returns:
        true if thread made some progress. Which is await was unblocked and some code after it * was executed.
      • isDestroyRequested

        public boolean isDestroyRequested()
      • destroy

        public void destroy()
      • exit

        public void exit()
        To be called only from a workflow thread.
      • initializeCurrentThread

        public void initializeCurrentThread​(java.lang.Thread currentThread)
      • getCurrentThread

        @Nullable
        public java.lang.Thread getCurrentThread()
        Returns:
        current thread that owns this context, could be null if the execution finished or didn't start yet