Interface WorkflowThread
- All Superinterfaces:
CancellationScope,Runnable
- All Known Implementing Classes:
RootWorkflowThreadImpl
Thread that is scheduled deterministically by
DeterministicRunner.-
Method Summary
Modifier and TypeMethodDescriptionvoidaddStackTrace(StringBuilder result) static voidBlock current thread until unblockCondition is evaluated to true.static voidexit()Stop executing all workflow threads and putsDeterministicRunnerinto closed state.voidlonggetId()getName()intio.temporal.internal.sync.DeterministicRunnerImplio.temporal.internal.sync.SyncWorkflowContextio.temporal.internal.sync.WorkflowThreadContextbooleanisDone()booleanDisables deadlock detector on this threadstatic WorkflowThreadCreates a new thread instance.static WorkflowThreadbooleanrunUntilBlocked(long deadlockDetectionTimeoutMs) void<T> voidsetThreadLocal(WorkflowThreadLocalInternal<T> key, T value) voidstart()Future<?> stopNow()voidMethods inherited from interface io.temporal.workflow.CancellationScope
cancel, cancel, getCancellationReason, getCancellationRequest, isCancelRequested, isDetached
-
Method Details
-
await
static void await(String reason, Supplier<Boolean> unblockCondition) throws DestroyWorkflowThreadError Block current thread until unblockCondition is evaluated to true. This method is intended for framework level libraries, never use directly in a workflow implementation.- Parameters:
reason- reason for blockingunblockCondition- condition that should return true to indicate that thread should unblock.- Throws:
CanceledFailure- if thread (or current cancellation scope was canceled).DestroyWorkflowThreadError- if thread was asked to be destroyed.
-
newThread
Creates a new thread instance.- Parameters:
runnable- thread function to rundetached- If this thread is detached from the parentCancellationScope- Returns:
-
newThread
-
start
void start() -
isStarted
boolean isStarted() -
setName
-
getName
String getName() -
getId
long getId() -
getPriority
int getPriority() -
getStackTrace
String getStackTrace() -
getRunner
io.temporal.internal.sync.DeterministicRunnerImpl getRunner() -
getWorkflowContext
io.temporal.internal.sync.SyncWorkflowContext getWorkflowContext() -
runUntilBlocked
boolean runUntilBlocked(long deadlockDetectionTimeoutMs) - Parameters:
deadlockDetectionTimeoutMs- maximum time in milliseconds the thread can run before calling yield.- Returns:
- true if coroutine made some progress.
-
lockDeadlockDetector
NonIdempotentHandle lockDeadlockDetector()Disables deadlock detector on this thread- Returns:
- a handle that must be used to unlock the deadlock detector back
-
getUnhandledException
Throwable getUnhandledException() -
isDone
boolean isDone() -
stopNow
Future<?> stopNow() -
addStackTrace
-
yield
- Throws:
DestroyWorkflowThreadError
-
exit
static void exit()Stop executing all workflow threads and putsDeterministicRunnerinto closed state. To be called only from a workflow thread. -
exitThread
void exitThread() -
setThreadLocal
-
getThreadLocal
-
getWorkflowThreadContext
io.temporal.internal.sync.WorkflowThreadContext getWorkflowThreadContext()
-