public abstract class AbstractCandidate extends java.lang.Object implements Candidate
Candidate
.Constructor and Description |
---|
AbstractCandidate()
Instantiate a abstract candidate.
|
AbstractCandidate(java.lang.String id,
java.lang.String role)
Instantiate a abstract candidate.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getId()
Gets the identifier.
|
java.lang.String |
getRole()
Gets the role.
|
abstract void |
onGranted(Context ctx)
Callback method invoked when this candidate is elected leader.
|
abstract void |
onRevoked(Context ctx)
Callback method invoked when this candidate is no longer leader.
|
public AbstractCandidate()
public AbstractCandidate(java.lang.String id, java.lang.String role)
id
- the identifierrole
- the rolepublic java.lang.String getRole()
Candidate
public java.lang.String getId()
Candidate
public abstract void onGranted(Context ctx) throws java.lang.InterruptedException
Candidate
InterruptedException
. When the thread
is interrupted, this indicates that this candidate is no
longer leader.