Package io.temporal.internal
Class WorkflowThreadMarker
- java.lang.Object
-
- io.temporal.internal.WorkflowThreadMarker
-
public abstract class WorkflowThreadMarker extends java.lang.ObjectProvides 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 Modifier and Type Field Description protected static java.lang.ThreadLocal<java.lang.Boolean>isWorkflowThreadThreadLocal
-
Constructor Summary
Constructors Constructor Description WorkflowThreadMarker()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidenforceNonWorkflowThread()ThrowsIllegalStateExceptionif it's called from workflow thread.static booleanisWorkflowThread()static <T> TprotectFromWorkflowThread(T instance, java.lang.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
-
-
-
Method Detail
-
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.
-
protectFromWorkflowThread
public static <T> T protectFromWorkflowThread(T instance, java.lang.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- 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
-
-