public interface MultipleComponentLeaderElectionService
LeaderElectionEventHandlers
that are identified by different names. For each event handler it is
possible to write the corresponding LeaderInformation
.Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this service.
|
MultipleComponentLeaderElectionDriverFactory |
createDriverFactory(String componentId)
Creates a
MultipleComponentLeaderElectionDriverFactory for the given leader name. |
boolean |
hasLeadership(String componentId)
Returns whether the given component has leadership.
|
void |
publishLeaderInformation(String componentId,
LeaderInformation leaderInformation)
Publishes the given leader information for the component identified by the given leader name.
|
void |
registerLeaderElectionEventHandler(String componentId,
LeaderElectionEventHandler leaderElectionEventHandler)
Registers a new leader election event handler under the given component id.
|
void |
unregisterLeaderElectionEventHandler(String componentId)
Unregisters the leader election event handler with the given component id.
|
void close() throws Exception
Exception
- if the service failed to closeMultipleComponentLeaderElectionDriverFactory createDriverFactory(String componentId)
MultipleComponentLeaderElectionDriverFactory
for the given leader name.componentId
- identifying the component for which to create a leader election driver
factoryvoid publishLeaderInformation(String componentId, LeaderInformation leaderInformation)
componentId
- identifying the componentleaderInformation
- leader informationvoid registerLeaderElectionEventHandler(String componentId, LeaderElectionEventHandler leaderElectionEventHandler)
componentId
- identifying the leader election event handlerleaderElectionEventHandler
- leader election event handler to registerIllegalArgumentException
- if there is already a handler registered for the given
component idvoid unregisterLeaderElectionEventHandler(String componentId) throws Exception
componentId
- identifying the componentException
- if the leader election event handler could not be unregisteredboolean hasLeadership(String componentId)
componentId
- identifying the componenttrue
if the component has leadership otherwise false
Copyright © 2014–2023 The Apache Software Foundation. All rights reserved.