Enum Class JGroupsRaftRole
- All Implemented Interfaces:
Serializable, Comparable<JGroupsRaftRole>, Constable
Nodes can transition between the following roles:
NONE ──┬── LEARNER
│
└── FOLLOWER ──── LEADER
↑ │
└───────────┘
- NONE: Node not initialized or stopped
- LEARNER: Node connects but not in membership list
- FOLLOWER: Node connects and is in membership list
- LEADER: Elected from FOLLOWER role
- Since:
- 2.0
- Author:
- José Bolina
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionstatic JGroupsRaftRoleReturns the enum constant of this class with the specified name.static JGroupsRaftRole[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
NONE
Indicates no active role.This state occurs when the Raft node is not initialized, has been stopped (
JGroupsRaft.stop()), or is in a transitional state before assuming an active role after callingJGroupsRaft.start(). -
LEADER
The leader role in the Raft consensus algorithm.The leader is responsible for accepting client requests, replicating log entries to followers, and coordinating the consensus process. Only one leader exists per term in a functioning cluster. JGroups Raft handles leader election through
Viewchanges in JGroups. Therefore, there are no competing candidates or timeouts for starting elections. You can learn more about the implementation in design documents. -
FOLLOWER
The follower role in the Raft consensus algorithm.Followers passively receive and acknowledge log entries from the leader, participate in leader elections, and can become candidates when the leader becomes unavailable.
-
LEARNER
The learner role as described in Raft optimizations.Learners receive log entries from the leader but do not participate in voting or consensus decisions. This role is typically used for nodes that need to catch up on the log or for read-only replicas. Every node that joins the cluster and is not in the Raft membership is considered a learner. This approach allows for dynamic scaling of the cluster without affecting the quorum required for consensus. The node can be promoted to a full member of the Raft cluster by updating the Raft configuration to include it in the membership after it has caught up with all changes. You can learn more about the implementation in design documents.
-
-
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
-