Class WorkflowThreadMarker
java.lang.Object
io.temporal.internal.WorkflowThreadMarker
Provides an access to information about a thread type the current code executes in to perform
different type of access checks inside Temporal library code.
Note: This class is a singleton and is not intended for an extension.
Note: This class shouldn't be accessed in any way by the application code.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidThrowsIllegalStateExceptionif it's called from workflow thread.static booleanstatic <T> TprotectFromWorkflowThread(T instance, Class<T> iface) Create a proxy that checks all methods executions if they are done from a workflow thread and makes them throw an IllegalStateException if they are indeed triggered from workflow code
-
Field Details
-
isWorkflowThreadThreadLocal
-
-
Constructor Details
-
WorkflowThreadMarker
public WorkflowThreadMarker()
-
-
Method Details
-
isWorkflowThread
public static boolean isWorkflowThread()- Returns:
- true if the current thread is workflow thread
-
enforceNonWorkflowThread
public static void enforceNonWorkflowThread()ThrowsIllegalStateExceptionif it's called from workflow thread.- See Also:
-
protectFromWorkflowThread
Create a proxy that checks all methods executions if they are done from a workflow thread and makes them throw an IllegalStateException if they are indeed triggered from workflow code- Parameters:
instance- an instance to wrapiface- an interface theinstanceimplements and that proxy should implement and intercept- Returns:
- a proxy that makes sure that it's methods can't be called from workflow thread
-