public interface LeaderElectionEventHandler
LeaderElectionDriver
.
Important: The LeaderElectionDriver
could not guarantee that there is
no LeaderElectionEventHandler
callbacks happen after AutoCloseable.close()
. This means that the implementor of LeaderElectionEventHandler
is responsible for filtering out spurious callbacks(e.g. after close
has been called on LeaderElectionDriver
).
Modifier and Type | Method and Description |
---|---|
void |
onGrantLeadership(UUID newLeaderSessionId)
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(UUID newLeaderSessionId)
LeaderElectionDriver
when the leadership is granted.newLeaderSessionId
- the valid leader session idvoid 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–2024 The Apache Software Foundation. All rights reserved.