Package io.temporal.internal.sync
Class WorkflowThreadContext
- java.lang.Object
-
- io.temporal.internal.sync.WorkflowThreadContext
-
public class WorkflowThreadContext extends java.lang.Object
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
destroy()
void
evaluateInCoroutineContext(Functions.Proc1<java.lang.String> function)
Callfunction
by the thread that owns this context and is currently blocked in a await.void
exit()
To be called only from a workflow thread.java.lang.Thread
getCurrentThread()
io.temporal.internal.sync.Status
getStatus()
java.lang.Throwable
getUnhandledException()
java.lang.String
getYieldReason()
void
initializeCurrentThread(java.lang.Thread currentThread)
void
initialYield()
boolean
isDestroyRequested()
boolean
isDone()
boolean
runUntilBlocked(long deadlockDetectionTimeoutMs)
void
setStatus(io.temporal.internal.sync.Status status)
void
setUnhandledException(java.lang.Throwable unhandledException)
void
yield(java.lang.String reason, java.util.function.Supplier<java.lang.Boolean> unblockFunction)
-
-
-
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)
Callfunction
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 ifTEMPORAL_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
-
-