Package io.aeron.cluster
Enum Class ClusterControl.ToggleState
- All Implemented Interfaces:
Serializable,Comparable<ClusterControl.ToggleState>,Constable
- Enclosing class:
- ClusterControl
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 ConstantDescriptionAbort processing and terminate the cluster without taking a snapshot.Inactive state, not accepting new actions.Neutral state ready to accept a new action.Resume processing of ingress and timers.Shut down the cluster in an orderly fashion by taking a snapshot first then terminating.Take a snapshot of cluster state.Trigger a snapshot that will only occur on a cluster standby.Suspend processing of ingress and timers. -
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 ClusterControl.ToggleStateget(AtomicCounter controlToggle) Get theClusterControl.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 requestedClusterControl.ToggleState.static ClusterControl.ToggleStateReturns the enum constant of this class with the specified name.static ClusterControl.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. -
SUSPEND
Suspend processing of ingress and timers. -
RESUME
Resume processing of ingress and timers. -
SNAPSHOT
Take a snapshot of cluster state. -
SHUTDOWN
Shut down the cluster in an orderly fashion by taking a snapshot first then terminating. -
ABORT
Abort processing and terminate the cluster without taking a snapshot. -
STANDBY_SNAPSHOT
Trigger a snapshot that will only occur on a cluster standby.
-
-
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 requestedClusterControl.ToggleState.This action is thread safe and will succeed if the toggle is in the
NEUTRALstate, or if toggle isSUSPENDand requested state isRESUME.- 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 theClusterControl.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.
-