public class Leader<T> extends Object
Identified by the node identifier and a monotonically increasing term number.
The term number is incremented by one every time a new node is elected as leader.
Also available is the system clock time at the instant when this node was elected as leader.
Keep in mind though that as with any system clock based time stamps this particular information
susceptible to clock skew and should only be relied on for simple diagnostic purposes.
| Constructor and Description |
|---|
Leader(T id,
long term,
long termStartTime) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object other) |
int |
hashCode() |
T |
id()
Returns the identifier for of leader.
|
<U> Leader<U> |
map(Function<T,U> mapper)
Converts the leader identifier using the given mapping function.
|
long |
term()
Returns the leader's term.
|
long |
timestamp()
Returns the system time when the current leadership term started.
|
String |
toString() |
public Leader(T id, long term, long termStartTime)
public T id()
public long term()
public long timestamp()
public <U> Leader<U> map(Function<T,U> mapper)
U - the converted typemapper - the mapping function with which to convert the identifierCopyright © 2013–2018. All rights reserved.