Class ExecutionContext

java.lang.Object
io.keikai.model.sys.ExecutionContext

public class ExecutionContext extends Object
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 Details

    • ExecutionContext

      public ExecutionContext()
  • Method Details

    • getCurrent

      public static ExecutionContext 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

      public static ExecutionContext 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

      public Object getAttribute(String key)
      Gets an attribute from the execution context.
    • setAttribute

      public void setAttribute(String key, Object value)
      Sets an attribute in the execution context.
    • getAttribute

      public Object getAttribute(String key, boolean scope)
      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

      public void setAttribute(String key, Object value, boolean scope)
      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.