public interface LeaderElectionEventHandler
LeaderElectionDriver.
Important: The LeaderElectionDriver could not guarantee that there is
no LeaderElectionEventHandler callbacks happen after LeaderElectionDriver.close(). This means that the implementor of LeaderElectionEventHandler is responsible for filtering out spurious callbacks(e.g. after close
has been called on LeaderElectionDriver).
| 限定符和类型 | 方法和说明 |
|---|---|
void |
onGrantLeadership()
Called by specific
LeaderElectionDriver when the leadership is granted. |
void |
onLeaderInformationChange(LeaderInformation leaderInformation)
Called by specific
LeaderElectionDriver when the leader information is changed. |
void |
onRevokeLeadership()
Called by specific
LeaderElectionDriver when the leadership is revoked. |
void onGrantLeadership()
LeaderElectionDriver when the leadership is granted.void onRevokeLeadership()
LeaderElectionDriver when the leadership is revoked.void onLeaderInformationChange(LeaderInformation leaderInformation)
LeaderElectionDriver when the leader information is changed. Then
the LeaderElectionService could write the leader information again if necessary. This
method should only be called when LeaderElectionDriver.hasLeadership() is true.
Duplicated leader change events could happen, so the implementation should check whether the
passed leader information is really different with internal confirmed leader information.leaderInformation - leader information which contains leader session id and leader
address.Copyright © 2014–2022 The Apache Software Foundation. All rights reserved.