public interface LeaderElectionDriver
LeaderElectionDriver is 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 LeaderElectionEventHandler if it want to respond to the leader change
events.
Important: The LeaderElectionDriver could not guarantee that there is
no LeaderElectionEventHandler callbacks happen after close().
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the services used for leader election.
|
boolean |
hasLeadership()
Check whether the driver still have the leadership in the distributed coordination system.
|
void |
writeLeaderInformation(LeaderInformation leaderInformation)
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.boolean hasLeadership()
Copyright © 2014–2022 The Apache Software Foundation. All rights reserved.