public interface Candidate
onGranted(Context)
and onRevoked(Context)
are invoked when leadership is
granted and revoked.Modifier and Type | Method and Description |
---|---|
String |
getId()
Gets the identifier.
|
String |
getRole()
Gets the role.
|
void |
onGranted(Context ctx)
Callback method invoked when this candidate is elected leader.
|
void |
onRevoked(Context ctx)
Callback method invoked when this candidate is no longer leader.
|
String getRole()
String getId()
void onGranted(Context ctx) throws InterruptedException
InterruptedException
. When the thread
is interrupted, this indicates that this candidate is no
longer leader.ctx
- leadership contextInterruptedException
- when this candidate is no longer leadervoid onRevoked(Context ctx)
ctx
- leadership context