public abstract class AbstractCandidate extends Object implements Candidate
Candidate
.Constructor and Description |
---|
AbstractCandidate()
Instantiate a abstract candidate.
|
AbstractCandidate(String id,
String role)
Instantiate a abstract candidate.
|
Modifier and Type | Method and Description |
---|---|
String |
getId()
Gets the identifier.
|
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 abstract void onGranted(Context ctx) throws InterruptedException
Candidate
InterruptedException
. When the thread
is interrupted, this indicates that this candidate is no
longer leader.onGranted
in interface Candidate
ctx
- leadership contextInterruptedException
- when this candidate is no longer leader