Class ZooKeeperHelper
java.lang.Object
org.apache.hadoop.hbase.zookeeper.ZooKeeperHelper
Methods that help working with ZooKeeper
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.zookeeper.ZooKeeper
ensureConnectedZooKeeper
(org.apache.zookeeper.ZooKeeper zookeeper, int timeout) Ensure passed zookeeper is connected.static org.apache.zookeeper.ZooKeeper
getConnectedZooKeeper
(String connectString, int sessionTimeoutMs) Get a ZooKeeper instance and wait until it connected before returning.
-
Constructor Details
-
ZooKeeperHelper
private ZooKeeperHelper()
-
-
Method Details
-
getConnectedZooKeeper
public static org.apache.zookeeper.ZooKeeper getConnectedZooKeeper(String connectString, int sessionTimeoutMs) throws IOException Get a ZooKeeper instance and wait until it connected before returning.- Parameters:
sessionTimeoutMs
- Used as session timeout passed to the created ZooKeeper AND as the timeout to wait on connection establishment.- Throws:
IOException
-
ensureConnectedZooKeeper
public static org.apache.zookeeper.ZooKeeper ensureConnectedZooKeeper(org.apache.zookeeper.ZooKeeper zookeeper, int timeout) throws ZooKeeperConnectionException Ensure passed zookeeper is connected.- Parameters:
timeout
- Time to wait on established Connection- Throws:
ZooKeeperConnectionException
-