public class StandaloneLeaderElectionService extends AbstractLeaderElectionService
LeaderElectionService
interface. The standalone
implementation assumes that there is only a single LeaderContender
and thus directly
grants him the leadership upon start up. Furthermore, there is no communication needed between
multiple standalone leader election services.Constructor and Description |
---|
StandaloneLeaderElectionService() |
Modifier and Type | Method and Description |
---|---|
protected void |
confirmLeadership(UUID leaderSessionID,
String leaderAddress)
Confirms the leadership with the given session ID and address.
|
protected boolean |
hasLeadership(UUID leaderSessionId)
Checks whether the
LeaderElectionService has the leadership acquired for the given
session ID. |
protected void |
register(LeaderContender newContender)
Registers the given
LeaderContender with the underlying LeaderElectionService . |
protected void |
remove(LeaderContender contender)
Removes the passed
LeaderContender from the LeaderElectionService . |
createLeaderElection
protected void register(LeaderContender newContender) throws Exception
AbstractLeaderElectionService
LeaderContender
with the underlying LeaderElectionService
. Leadership changes are starting to be reported to the LeaderContender
.register
in class AbstractLeaderElectionService
Exception
protected void remove(LeaderContender contender)
AbstractLeaderElectionService
LeaderContender
from the LeaderElectionService
.remove
in class AbstractLeaderElectionService
protected void confirmLeadership(UUID leaderSessionID, String leaderAddress)
AbstractLeaderElectionService
confirmLeadership
in class AbstractLeaderElectionService
protected boolean hasLeadership(UUID leaderSessionId)
AbstractLeaderElectionService
LeaderElectionService
has the leadership acquired for the given
session ID.hasLeadership
in class AbstractLeaderElectionService
true
if the service has leadership with the passed session ID acquired;
false
otherwise.Copyright © 2014–2023 The Apache Software Foundation. All rights reserved.