Package io.aeron.cluster
Enum Class ConsensusModule.State
- All Implemented Interfaces:
Serializable,Comparable<ConsensusModule.State>,Constable
- Enclosing class:
- ConsensusModule
Possible states for the
ConsensusModule.
These will be reflected in the ConsensusModule.Context.moduleStateCounter() counter.-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionActive state with ingress and expired timers appended to the log.Terminal state.Starting up and recovering state.Quitting the cluster and shutting down as soon as services ack without taking a snapshot.In the process of taking a snapshot.Suspended processing of ingress and expired timers.In the process of terminating the node. -
Method Summary
Modifier and TypeMethodDescriptionfinal intcode()Code to be stored in anAtomicCounterfor the enum value.static ConsensusModule.Statefind(CountersReader counters, int clusterId) Get the current state of theConsensusModule.static ConsensusModule.Stateget(long code) Get theConsensusModule.Statecorresponding to a particular code.static ConsensusModule.Stateget(AtomicCounter counter) Get theConsensusModule.Stateencoded in anAtomicCounter.static ConsensusModule.StateReturns the enum constant of this class with the specified name.static ConsensusModule.State[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
INIT
Starting up and recovering state. -
ACTIVE
Active state with ingress and expired timers appended to the log. -
SUSPENDED
Suspended processing of ingress and expired timers. -
SNAPSHOT
In the process of taking a snapshot. -
QUITTING
Quitting the cluster and shutting down as soon as services ack without taking a snapshot. -
TERMINATING
In the process of terminating the node. -
CLOSED
Terminal state.
-
-
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 stored in anAtomicCounterfor the enum value.- Returns:
- code to be stored in an
AtomicCounterfor the enum value.
-
get
Get theConsensusModule.Stateencoded in anAtomicCounter.- Parameters:
counter- to get the current state for.- Returns:
- the state for the
ConsensusModule. - Throws:
ClusterException- if the counter is not one of the valid values.
-
get
Get theConsensusModule.Statecorresponding to a particular code.- Parameters:
code- representing aConsensusModule.State.- Returns:
- the
ConsensusModule.Statecorresponding to the provided code. - Throws:
ClusterException- if the code does not correspond to a valid State.
-
find
Get the current state of theConsensusModule.- Parameters:
counters- to search within.clusterId- to which the allocated counter belongs.- Returns:
- the state of the ConsensusModule or null if not found.
-