Package io.aeron.cluster.service
Enum Class Cluster.Role
- All Implemented Interfaces:
Serializable,Comparable<Cluster.Role>,Constable
- Enclosing interface:
- Cluster
Role of the node in the cluster.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionfinal intcode()The code which matches the role in the cluster.static Cluster.Roleget(long code) Get the role from a code read from a counter.static Cluster.Roleget(AtomicCounter counter) Get the role by reading the code from a counter.static Cluster.RoleReturns the enum constant of this class with the specified name.static Cluster.Role[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
FOLLOWER
The cluster node is a follower in the current leadership term. -
CANDIDATE
The cluster node is a candidate to become a leader in an election. -
LEADER
The cluster node is the leader for the current leadership term.
-
-
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()The code which matches the role in the cluster.- Returns:
- the code which matches the role in the cluster.
-
get
Get the role from a code read from a counter.- Parameters:
code- for theCluster.Role.- Returns:
- the
Cluster.Roleof the cluster node.
-
get
Get the role by reading the code from a counter.- Parameters:
counter- containing the value of the role.- Returns:
- the role for the cluster member.
-