public class ZooKeeperLeaderRetrievalDriver extends Object implements LeaderRetrievalDriver, org.apache.flink.shaded.curator4.org.apache.curator.framework.recipes.cache.NodeCacheListener, org.apache.flink.shaded.curator4.org.apache.curator.framework.api.UnhandledErrorListener
ZooKeeperLeaderElectionDriver
. LeaderRetrievalService
implementation for Zookeeper. It retrieves the current leader which has been elected by the
ZooKeeperLeaderElectionDriver
. The leader address as well as the current leader session
ID is retrieved from ZooKeeper.Constructor and Description |
---|
ZooKeeperLeaderRetrievalDriver(org.apache.flink.shaded.curator4.org.apache.curator.framework.CuratorFramework client,
String retrievalPath,
LeaderRetrievalEventHandler leaderRetrievalEventHandler,
FatalErrorHandler fatalErrorHandler)
Creates a leader retrieval service which uses ZooKeeper to retrieve the leader information.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the services used for leader retrieval.
|
void |
nodeChanged() |
String |
toString() |
void |
unhandledError(String s,
Throwable throwable) |
public ZooKeeperLeaderRetrievalDriver(org.apache.flink.shaded.curator4.org.apache.curator.framework.CuratorFramework client, String retrievalPath, LeaderRetrievalEventHandler leaderRetrievalEventHandler, FatalErrorHandler fatalErrorHandler) throws Exception
client
- Client which constitutes the connection to the ZooKeeper quorumretrievalPath
- Path of the ZooKeeper node which contains the leader informationleaderRetrievalEventHandler
- Handler to notify the leader changes.fatalErrorHandler
- Fatal error handlerException
public void close() throws Exception
LeaderRetrievalDriver
close
in interface LeaderRetrievalDriver
Exception
public void nodeChanged()
nodeChanged
in interface org.apache.flink.shaded.curator4.org.apache.curator.framework.recipes.cache.NodeCacheListener
public void unhandledError(String s, Throwable throwable)
unhandledError
in interface org.apache.flink.shaded.curator4.org.apache.curator.framework.api.UnhandledErrorListener
Copyright © 2014–2022 The Apache Software Foundation. All rights reserved.