Package io.keikai.model.sys
Class ExecutionContext
java.lang.Object
io.keikai.model.sys.ExecutionContext
Thread-local execution context that replaces ZK's Executions.getCurrent().
In ZK UI mode, the keikai module activates this context during request processing.
In headless mode, this context is either empty or manually activated.
Thread safety: Each thread sees its own context via the
ThreadLocal. The instance attribute map (getAttribute(java.lang.String),
setAttribute(java.lang.String, java.lang.Object)) is a plain HashMap — it is NOT safe to
share a single ExecutionContext instance across threads. Do not
pass an instance returned by getCurrent() to another thread.
- Since:
- 7.0.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ExecutionContextactivate()Activates an execution context for the current thread.static voidDeactivates the current execution context.getAttribute(String key) Gets an attribute from the execution context.getAttribute(String key, boolean scope) Gets an attribute from the execution context.static ExecutionContextReturns the current execution context, or null if not in an active execution.static booleanisActive()Returns true if there is an active execution context.voidsetAttribute(String key, Object value) Sets an attribute in the execution context.voidsetAttribute(String key, Object value, boolean scope) Sets an attribute in the execution context.
-
Constructor Details
-
ExecutionContext
public ExecutionContext()
-
-
Method Details
-
getCurrent
Returns the current execution context, or null if not in an active execution. -
isActive
public static boolean isActive()Returns true if there is an active execution context. -
activate
Activates an execution context for the current thread. Returns the context for fluent usage. -
deactivate
public static void deactivate()Deactivates the current execution context. -
getAttribute
Gets an attribute from the execution context. -
setAttribute
Sets an attribute in the execution context. -
getAttribute
Gets an attribute from the execution context. The scope parameter is accepted for API compatibility with ZK's Execution but is ignored in this implementation. -
setAttribute
Sets an attribute in the execution context. The scope parameter is accepted for API compatibility with ZK's Execution but is ignored in this implementation.
-