public class ZooKeeperMultipleComponentLeaderElectionDriver extends Object implements MultipleComponentLeaderElectionDriver, org.apache.flink.shaded.curator5.org.apache.curator.framework.recipes.leader.LeaderLatchListener
MultipleComponentLeaderElectionDriver
implementation.MultipleComponentLeaderElectionDriver.Listener
Constructor and Description |
---|
ZooKeeperMultipleComponentLeaderElectionDriver(org.apache.flink.shaded.curator5.org.apache.curator.framework.CuratorFramework curatorFramework,
MultipleComponentLeaderElectionDriver.Listener leaderElectionListener) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the driver.
|
void |
deleteLeaderInformation(String leaderName)
Deletes the leader information for the given component.
|
boolean |
hasLeadership()
Returns whether the driver has currently leadership.
|
void |
isLeader() |
void |
notLeader() |
void |
publishLeaderInformation(String componentId,
LeaderInformation leaderInformation)
Publishes the leader information for the given component.
|
String |
toString() |
public ZooKeeperMultipleComponentLeaderElectionDriver(org.apache.flink.shaded.curator5.org.apache.curator.framework.CuratorFramework curatorFramework, MultipleComponentLeaderElectionDriver.Listener leaderElectionListener) throws Exception
Exception
public void close() throws Exception
MultipleComponentLeaderElectionDriver
close
in interface MultipleComponentLeaderElectionDriver
Exception
- if closing this driver failspublic boolean hasLeadership()
MultipleComponentLeaderElectionDriver
hasLeadership
in interface MultipleComponentLeaderElectionDriver
true
if the driver has leadership, otherwise false
public void publishLeaderInformation(String componentId, LeaderInformation leaderInformation) throws Exception
MultipleComponentLeaderElectionDriver
publishLeaderInformation
in interface MultipleComponentLeaderElectionDriver
componentId
- identifying the component for which to publish the leader informationleaderInformation
- leader information of the respective componentException
- if publishing failspublic void deleteLeaderInformation(String leaderName) throws Exception
MultipleComponentLeaderElectionDriver
deleteLeaderInformation
in interface MultipleComponentLeaderElectionDriver
leaderName
- identifying the component for which to delete the leader informationException
- if deleting failspublic void isLeader()
isLeader
in interface org.apache.flink.shaded.curator5.org.apache.curator.framework.recipes.leader.LeaderLatchListener
public void notLeader()
notLeader
in interface org.apache.flink.shaded.curator5.org.apache.curator.framework.recipes.leader.LeaderLatchListener
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.