Interface LeaderElectionService
-
- All Known Implementing Classes:
DefaultLeaderElectionService
public interface LeaderElectionService
Interface for a service which allows to elect a leader among a group of contenders.Prior to using this service, it has to be started calling the start method. The start method takes the contender as a parameter. If there are multiple contenders, then each contender has to instantiate its own leader election service.
Once a contender has been granted leadership he has to confirm the received leader session ID by calling the method
LeaderElection.confirmLeadership(UUID, String)
. This will notify the leader election service, that the contender has accepted the leadership specified and that the leader session id as well as the leader address can now be published for leader retrieval services.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description LeaderElection
createLeaderElection(String componentId)
Creates a newLeaderElection
instance that is registered to thisLeaderElectionService
instance.
-
-
-
Method Detail
-
createLeaderElection
LeaderElection createLeaderElection(String componentId)
Creates a newLeaderElection
instance that is registered to thisLeaderElectionService
instance.- Parameters:
componentId
- a unique identifier that refers to the stored leader information that the newly createdLeaderElection
manages.
-
-