Package io.aeron.cluster
Enum Class NodeControl.ToggleState
- All Implemented Interfaces:
Serializable,Comparable<NodeControl.ToggleState>,Constable
- Enclosing class:
- NodeControl
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.-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionInactive state, not accepting new actions.Neutral state ready to accept a new action.Trigger a replication of the most resent standby snapshots. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidactivate(AtomicCounter controlToggle) Activate the toggle by setting it to theNEUTRALstate.final intcode()Code to be used as the indicator in the control toggle counter.static voiddeactivate(AtomicCounter controlToggle) Activate the toggle by setting it to theINACTIVEstate.static NodeControl.ToggleStateget(AtomicCounter controlToggle) Get theNodeControl.ToggleStatefor a given control toggle.static voidreset(AtomicCounter controlToggle) Reset the toggle to theNEUTRALstate.final booleantoggle(AtomicCounter controlToggle) Toggle the control counter to trigger the requestedNodeControl.ToggleState.static NodeControl.ToggleStateReturns the enum constant of this class with the specified name.static NodeControl.ToggleState[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
INACTIVE
Inactive state, not accepting new actions. -
NEUTRAL
Neutral state ready to accept a new action. -
REPLICATE_STANDBY_SNAPSHOT
Trigger a replication of the most resent standby snapshots.
-
-
Method Details
-
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
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 nameNullPointerException- 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
Toggle the control counter to trigger the requestedNodeControl.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
Reset the toggle to theNEUTRALstate.- Parameters:
controlToggle- to be reset.
-
activate
Activate the toggle by setting it to theNEUTRALstate.- Parameters:
controlToggle- to be activated.
-
deactivate
Activate the toggle by setting it to theINACTIVEstate.- Parameters:
controlToggle- to be deactivated.
-
get
Get theNodeControl.ToggleStatefor 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.
-