public static class LeaderElection.Adapter extends Object implements LeaderElection.Listener
LeaderElection.Listener
.Constructor and Description |
---|
Adapter() |
Modifier and Type | Method and Description |
---|---|
void |
onFinish(LeaderElection election)
Called when it is detected that callback should not be called
any more.
|
void |
onLose(LeaderElection election)
Called when it is detected that another candidate is the leader.
|
void |
onStateChanged(LeaderElection election,
LeaderElection.State oldState,
LeaderElection.State newState)
Called when the state of the leader election changed.
|
void |
onVacant(LeaderElection election)
Called when it is detected that a leader does not exist.
|
void |
onWin(LeaderElection election)
Called when this candidate won a leader election.
|
public void onWin(LeaderElection election)
LeaderElection.Listener
onStateChanged()
.onWin
in interface LeaderElection.Listener
election
- The LeaderElection
instance which this
listener is associated with.public void onLose(LeaderElection election)
LeaderElection.Listener
onStateChanged()
.onLose
in interface LeaderElection.Listener
election
- The LeaderElection
instance which this
listener is associated with.public void onVacant(LeaderElection election)
LeaderElection.Listener
onStateChanged()
.onVacant
in interface LeaderElection.Listener
election
- The LeaderElection
instance which this
listener is associated with.public void onFinish(LeaderElection election)
LeaderElection.Listener
onStateChanged()
.onFinish
in interface LeaderElection.Listener
election
- The LeaderElection
instance which this
listener is associated with.public void onStateChanged(LeaderElection election, LeaderElection.State oldState, LeaderElection.State newState)
LeaderElection.Listener
onXxx
methods
(onWin()
,
onLose()
, onVacant()
and onFinish()
).onStateChanged
in interface LeaderElection.Listener
election
- The LeaderElection
instance which this
listener is associated with.oldState
- The previous state before the change.newState
- The new state after the change.Copyright © 2015. All rights reserved.