public class Leadership extends Object
NodeIds of Nodes that could
become leader for the topic, the epoch when the term for a given leader
began, and the system time when the term began. Note:
| Constructor and Description |
|---|
Leadership(String topic,
List<NodeId> candidates,
long epoch,
long electedTime) |
Leadership(String topic,
NodeId leader,
List<NodeId> candidates,
long epoch,
long electedTime) |
Leadership(String topic,
NodeId leader,
long epoch,
long electedTime) |
| Modifier and Type | Method and Description |
|---|---|
List<NodeId> |
candidates()
Returns an preference-ordered list of nodes that are in the leadership
race for this topic.
|
long |
electedTime()
The system time when the term started.
|
long |
epoch()
The epoch when the leadership was assumed.
|
boolean |
equals(Object obj) |
int |
hashCode() |
NodeId |
leader()
The nodeId of leader for this topic.
|
String |
topic()
The topic for which this leadership applies.
|
String |
toString() |
public Leadership(String topic, NodeId leader, List<NodeId> candidates, long epoch, long electedTime)
public String topic()
public NodeId leader()
public List<NodeId> candidates()
public long epoch()
Comparing epochs is only appropriate for leadership events for the same topic. The system guarantees that for any given topic the epoch for a new term is higher (not necessarily by 1) than the epoch for any previous term.
public long electedTime()
The elected time is initially set on the node coordinating the leader election using its local system time. Due to possible clock skew, relying on this value for determining event ordering is discouraged. Epoch is more appropriate for determining event ordering.
Copyright © 2015. All rights reserved.