Enum Class RunState

java.lang.Object
java.lang.Enum<RunState>
io.nosqlbench.engine.api.activityapi.core.RunState
All Implemented Interfaces:
Serializable, Comparable<RunState>, Constable

public enum RunState extends Enum<RunState>

This enum indicates the state of a thread within an activity. The state is kept in an atomic register. Ownership of state changes is shared between a supervising thread and a managed thread. Both can make changes to the state.

These states are ordered such that the highest ordinal state represents the most significant aggregate state of all motors. That is, if any has errored, then the other states do not matter. If any is finished, then stopped motors don't matter, and so on. This makes summarizing aggregate state simply a matter of ordering.

  • Enum Constant Details

    • Uninitialized

      public static final RunState Uninitialized
      Initial state after creation of a motor. This is the initial state upon instantiation of a motor, before it is called on to do any active logic besides what occurs in the constructor.
    • Starting

      public static final RunState Starting
      A thread has been invoked, but is initializing and preparing for its main control loop. This is signaled by the motor after Runnable.run(), but before entering the main processing loop.
    • Running

      public static final RunState Running
      A thread is iterating within the main control loop. This is signaled by the motor once initialization in the main loop is complete and immediately before it enters it's main processing loop.
    • Stopping

      public static final RunState Stopping

      The thread has been requested to stop. This can be set by a managing thread which is not the motor thread, or by the motor thread. In either case, the motor thread is required to observe changes to this and initiate shutdown.

    • Stopped

      public static final RunState Stopped
      The thread has stopped. This should only be set by the motor. This state will only be visible to signaling mechanisms so long as the motor is still managed.

      NOTE: When a motor is stopped or finished, its state will remain visible in state tracking until Motor.getState().MotorState.removeState() is called.

    • Finished

      public static final RunState Finished

      A thread has exhausted its supply of values on the input (AKA cycles), thus has completed its work. This is signaled upon a short read of the input by the motor.

      NOTE: When a motor is stopped or finished, its state will remain visible in state tracking until Motor.getState().MotorState.removeState() is called.

    • Errored

      public static final RunState Errored
      If a motor has seen an exception, it goes into errored state before propagating the error.
  • Method Details

    • values

      public static RunState[] 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 RunState 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
    • getCode

      public String getCode()
    • canTransitionTo

      public boolean canTransitionTo(RunState target)
      Parameters:
      target - The target state
      Returns:
      true if the current state is allowed to transition to the target state