public interface Candidate
onGranted(Context)
and onRevoked(Context)
are invoked when leadership is
granted and revoked.Modifier and Type | Method and Description |
---|---|
java.lang.String |
getId()
Gets the identifier.
|
java.lang.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.
|
java.lang.String getRole()
java.lang.String getId()
void onGranted(Context ctx) throws java.lang.InterruptedException
InterruptedException
. When the thread
is interrupted, this indicates that this candidate is no
longer leader.ctx
- leadership contextjava.lang.InterruptedException
- when this candidate is no longer leadervoid onRevoked(Context ctx)
ctx
- leadership context