@InterfaceAudience.Private public final class ZooKeeperHelper extends Object
Modifier and Type | Method and Description |
---|---|
static 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.
|
public static org.apache.zookeeper.ZooKeeper getConnectedZooKeeper(String connectString, int sessionTimeoutMs) throws IOException
sessionTimeoutMs
- Used as session timeout passed to the created ZooKeeper AND as the
timeout to wait on connection establishment.IOException
public static org.apache.zookeeper.ZooKeeper ensureConnectedZooKeeper(org.apache.zookeeper.ZooKeeper zookeeper, int timeout) throws ZooKeeperConnectionException
timeout
- Time to wait on established ConnectionZooKeeperConnectionException
Copyright © 2007–2019 Cloudera. All rights reserved.