Class ZooKeeperLeaderElectionDriver
java.lang.Object
org.apache.flink.runtime.leaderelection.ZooKeeperLeaderElectionDriver
- All Implemented Interfaces:
AutoCloseable,LeaderElectionDriver,org.apache.flink.shaded.curator5.org.apache.curator.framework.recipes.leader.LeaderLatchListener
public class ZooKeeperLeaderElectionDriver
extends Object
implements LeaderElectionDriver, org.apache.flink.shaded.curator5.org.apache.curator.framework.recipes.leader.LeaderLatchListener
ZooKeeper based
LeaderElectionDriver implementation.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.flink.runtime.leaderelection.LeaderElectionDriver
LeaderElectionDriver.Listener -
Constructor Summary
ConstructorsConstructorDescriptionZooKeeperLeaderElectionDriver(org.apache.flink.shaded.curator5.org.apache.curator.framework.CuratorFramework curatorFramework, LeaderElectionDriver.Listener leaderElectionListener) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voiddeleteLeaderInformation(String componentId) Deletes the leader information for the given component.booleanReturns whether the driver has currently leadership.voidisLeader()voidvoidpublishLeaderInformation(String componentId, LeaderInformation leaderInformation) Publishes the leader information for the given component.toString()
-
Constructor Details
-
ZooKeeperLeaderElectionDriver
public ZooKeeperLeaderElectionDriver(org.apache.flink.shaded.curator5.org.apache.curator.framework.CuratorFramework curatorFramework, LeaderElectionDriver.Listener leaderElectionListener) throws Exception - Throws:
Exception
-
-
Method Details
-
close
- Specified by:
closein interfaceAutoCloseable- Throws:
Exception
-
hasLeadership
public boolean hasLeadership()Description copied from interface:LeaderElectionDriverReturns whether the driver has currently leadership.- Specified by:
hasLeadershipin interfaceLeaderElectionDriver- Returns:
trueif the driver has leadership, otherwisefalse
-
publishLeaderInformation
Description copied from interface:LeaderElectionDriverPublishes the leader information for the given component.- Specified by:
publishLeaderInformationin interfaceLeaderElectionDriver- Parameters:
componentId- identifying the component for which to publish the leader informationleaderInformation- leader information of the respective component
-
deleteLeaderInformation
Description copied from interface:LeaderElectionDriverDeletes the leader information for the given component.- Specified by:
deleteLeaderInformationin interfaceLeaderElectionDriver- Parameters:
componentId- identifying the component for which to delete the leader information
-
isLeader
public void isLeader()- Specified by:
isLeaderin interfaceorg.apache.flink.shaded.curator5.org.apache.curator.framework.recipes.leader.LeaderLatchListener
-
notLeader
public void notLeader()- Specified by:
notLeaderin interfaceorg.apache.flink.shaded.curator5.org.apache.curator.framework.recipes.leader.LeaderLatchListener
-
toString
-