Enum Class ExecutionMode

java.lang.Object
java.lang.Enum<ExecutionMode>
com.scivicslab.pojoactor.workflow.ExecutionMode
All Implemented Interfaces:
Serializable, Comparable<ExecutionMode>, Constable

public enum ExecutionMode extends Enum<ExecutionMode>
Execution mode for workflow actions.

Determines how an action is executed:

  • POOL - Execute on work-stealing pool (default, safe for heavy operations)
  • DIRECT - Direct synchronous call (optimization for light operations)
Since:
2.7.0
Author:
devteam@scivics-lab.com
  • Enum Constant Details

    • POOL

      public static final ExecutionMode POOL
      Execute action on work-stealing pool thread.

      This is the default and recommended mode. Actions execute on real CPU threads from the work-stealing pool, preventing heavy computations from blocking virtual threads.

      Use for:

      • CPU-intensive operations
      • Long-running computations
      • Most workflow actions (safe default)
    • DIRECT

      public static final ExecutionMode DIRECT
      Execute action as direct synchronous call.

      Action executes on the caller thread without going through the actor's message queue or thread pool. Lowest overhead but can block the workflow thread.

      Use for:

      • Very light operations (getters, setters)
      • Logging
      • Simple state updates
      • When minimal latency is critical

      Warning: Heavy operations will block the workflow thread.

  • Method Details

    • values

      public static ExecutionMode[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static ExecutionMode valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • fromString

      public static ExecutionMode fromString(String value)
      Parses execution mode from string (case-insensitive).
      Parameters:
      value - the string value ("pool", "direct")
      Returns:
      the corresponding ExecutionMode, or POOL if null/empty