ZooKeeperMultipleComponentLeaderElectionDriver
@Deprecated public class ZooKeeperLeaderElectionDriver extends Object implements LeaderElectionDriver, org.apache.flink.shaded.curator5.org.apache.curator.framework.recipes.leader.LeaderLatchListener
LeaderElectionDriver
implementation for Zookeeper. The leading JobManager is elected
using ZooKeeper. The current leader's address as well as its leader session ID is published via
ZooKeeper.Constructor and Description |
---|
ZooKeeperLeaderElectionDriver(org.apache.flink.shaded.curator5.org.apache.curator.framework.CuratorFramework client,
String path,
LeaderElectionEventHandler leaderElectionEventHandler,
FatalErrorHandler fatalErrorHandler,
String leaderContenderDescription)
Deprecated.
Creates a ZooKeeperLeaderElectionDriver object.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Deprecated.
Close the services used for leader election.
|
boolean |
hasLeadership()
Deprecated.
Check whether the driver still have the leadership in the distributed coordination system.
|
void |
isLeader()
Deprecated.
|
void |
notLeader()
Deprecated.
|
String |
toString()
Deprecated.
|
void |
writeLeaderInformation(LeaderInformation leaderInformation)
Deprecated.
Writes the current leader's address as well the given leader session ID to ZooKeeper.
|
public ZooKeeperLeaderElectionDriver(org.apache.flink.shaded.curator5.org.apache.curator.framework.CuratorFramework client, String path, LeaderElectionEventHandler leaderElectionEventHandler, FatalErrorHandler fatalErrorHandler, String leaderContenderDescription) throws Exception
client
- Client which is connected to the ZooKeeper quorumpath
- ZooKeeper node path for the leader electionleaderElectionEventHandler
- Event handler for processing leader change eventsfatalErrorHandler
- Fatal error handlerleaderContenderDescription
- Leader contender descriptionException
public void close() throws Exception
LeaderElectionDriver
close
in interface LeaderElectionDriver
Exception
public boolean hasLeadership()
LeaderElectionDriver
hasLeadership
in interface LeaderElectionDriver
public 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
public void writeLeaderInformation(LeaderInformation leaderInformation)
writeLeaderInformation
in interface LeaderElectionDriver
leaderInformation
- current leader information. It could be LeaderInformation.empty()
, which means the caller want to clear the leader information
on external storage. Please remember that the clear operation should only happen before a
new leader is elected and has written his leader information on the storage. Otherwise,
we may have a risk to wrongly update the storage with empty leader information.Copyright © 2014–2023 The Apache Software Foundation. All rights reserved.