public interface LeaderElection extends AutoCloseable
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the
LeaderElection by deregistering the LeaderContender from the
underlying leader election. |
void |
confirmLeadership(UUID leaderSessionID,
String leaderAddress)
Confirms that the
LeaderContender has accepted the leadership identified by the given
leader session id. |
boolean |
hasLeadership(UUID leaderSessionId)
Returns
true if the service's LeaderContender has the leadership under the
given leader session ID acquired. |
void |
startLeaderElection(LeaderContender contender)
Registers the passed
LeaderContender with the leader election process. |
void startLeaderElection(LeaderContender contender) throws Exception
LeaderContender
with the leader election process.Exception
void confirmLeadership(UUID leaderSessionID, String leaderAddress)
LeaderContender
has accepted the leadership identified by the given
leader session id. It also publishes the leader address under which the leader is reachable.
The intention of this method is to establish an order between setting the new leader
session ID in the LeaderContender
and publishing the new leader session ID and the
related leader address to the leader retrieval services.
leaderSessionID
- The new leader session IDleaderAddress
- The address of the new leaderboolean hasLeadership(UUID leaderSessionId)
true
if the service's LeaderContender
has the leadership under the
given leader session ID acquired.leaderSessionId
- identifying the current leaderLeaderContender
is the leader, otherwise falsevoid close() throws Exception
LeaderElection
by deregistering the LeaderContender
from the
underlying leader election. LeaderContender.revokeLeadership()
will be called if the
service still holds the leadership.close
in interface AutoCloseable
Exception
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.