Enum Class NodeControl.ToggleState

java.lang.Object
java.lang.Enum<NodeControl.ToggleState>
io.aeron.cluster.NodeControl.ToggleState
All Implemented Interfaces:
Serializable, Comparable<NodeControl.ToggleState>, Constable
Enclosing class:
NodeControl

public static enum NodeControl.ToggleState extends Enum<NodeControl.ToggleState>
Toggle states for controlling the cluster node once it has entered the active state after initialising. The toggle can only we switched into a new state from NEUTRAL and will be reset by the ConsensusModule once the triggered action is complete.
  • Enum Constant Details

    • INACTIVE

      public static final NodeControl.ToggleState INACTIVE
      Inactive state, not accepting new actions.
    • NEUTRAL

      public static final NodeControl.ToggleState NEUTRAL
      Neutral state ready to accept a new action.
    • REPLICATE_STANDBY_SNAPSHOT

      public static final NodeControl.ToggleState REPLICATE_STANDBY_SNAPSHOT
      Trigger a replication of the most resent standby snapshots.
  • Method Details

    • values

      public static NodeControl.ToggleState[] 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 NodeControl.ToggleState 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
    • code

      public final int code()
      Code to be used as the indicator in the control toggle counter.
      Returns:
      code to be used as the indicator in the control toggle counter.
    • toggle

      public final boolean toggle(AtomicCounter controlToggle)
      Toggle the control counter to trigger the requested NodeControl.ToggleState.
      Parameters:
      controlToggle - to change to the trigger state.
      Returns:
      true if the counter toggles or false if it is in a state other than NEUTRAL.
    • reset

      public static void reset(AtomicCounter controlToggle)
      Reset the toggle to the NEUTRAL state.
      Parameters:
      controlToggle - to be reset.
    • activate

      public static void activate(AtomicCounter controlToggle)
      Activate the toggle by setting it to the NEUTRAL state.
      Parameters:
      controlToggle - to be activated.
    • deactivate

      public static void deactivate(AtomicCounter controlToggle)
      Activate the toggle by setting it to the INACTIVE state.
      Parameters:
      controlToggle - to be deactivated.
    • get

      public static NodeControl.ToggleState get(AtomicCounter controlToggle)
      Get the NodeControl.ToggleState for a given control toggle.
      Parameters:
      controlToggle - to get the current state for.
      Returns:
      the state for the current control toggle.
      Throws:
      ClusterException - if the counter is not one of the valid values.