@FunctionalInterface public interface Context
candidates
upon granting and revoking of leadership.
The Context
is FunctionalInterface
with no-op implementation for the yield()
.
Modifier and Type | Method and Description |
---|---|
default String |
getRole()
Get the role for the
Candidate . |
boolean |
isLeader()
Checks if the
Candidate this context was
passed to is the leader. |
default void |
yield()
Causes the
Candidate this context was passed to
to relinquish leadership. |
boolean isLeader()
Candidate
this context was
passed to is the leader.Candidate
this context was
passed to is the leaderdefault void yield()
Candidate
this context was passed to
to relinquish leadership. This method has no effect
if the candidate is not currently the leader.