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.
  • 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

      public void close() throws Exception
      Specified by:
      close in interface AutoCloseable
      Throws:
      Exception
    • hasLeadership

      public boolean hasLeadership()
      Description copied from interface: LeaderElectionDriver
      Returns whether the driver has currently leadership.
      Specified by:
      hasLeadership in interface LeaderElectionDriver
      Returns:
      true if the driver has leadership, otherwise false
    • publishLeaderInformation

      public void publishLeaderInformation(String componentId, LeaderInformation leaderInformation)
      Description copied from interface: LeaderElectionDriver
      Publishes the leader information for the given component.
      Specified by:
      publishLeaderInformation in interface LeaderElectionDriver
      Parameters:
      componentId - identifying the component for which to publish the leader information
      leaderInformation - leader information of the respective component
    • deleteLeaderInformation

      public void deleteLeaderInformation(String componentId)
      Description copied from interface: LeaderElectionDriver
      Deletes the leader information for the given component.
      Specified by:
      deleteLeaderInformation in interface LeaderElectionDriver
      Parameters:
      componentId - identifying the component for which to delete the leader information
    • isLeader

      public void isLeader()
      Specified by:
      isLeader in interface org.apache.flink.shaded.curator5.org.apache.curator.framework.recipes.leader.LeaderLatchListener
    • notLeader

      public void notLeader()
      Specified by:
      notLeader in interface org.apache.flink.shaded.curator5.org.apache.curator.framework.recipes.leader.LeaderLatchListener
    • toString

      public String toString()
      Overrides:
      toString in class Object