public interface LeaderElectionDriver extends AutoCloseable
LeaderElectionDriveris responsible for performing the leader election and storing the leader information. All the leader internal state is guarded by lock in
LeaderElectionService. Different driver implementations do not need to care about the lock. And it should use
LeaderElectionEventHandlerif it want to respond to the leader change events.
LeaderElectionDriver could not guarantee that there is
LeaderElectionEventHandler callbacks happen after
|Modifier and Type||Method and Description|
Check whether the driver still have the leadership in the distributed coordination system.
Write the current leader information to external persistent storage(e.g.
void writeLeaderInformation(LeaderInformation leaderInformation)
leaderInformation- current leader information. It could be
LeaderInformation.empty(), which means the caller want to clear the leader information on external storage. Please remember that the clear operation should only happen before a new leader is elected and has written his leader information on the storage. Otherwise, we may have a risk to wrongly update the storage with empty leader information.
Copyright © 2014–2023 The Apache Software Foundation. All rights reserved.