in hbase-oss/src/main/java/org/apache/hadoop/hbase/oss/sync/ZKTreeLockManager.java [76:110]
public void initialize(FileSystem fs) throws IOException {
this.fs = fs;
Configuration conf = fs.getConf();
int baseSleepTimeMs = conf.getInt(Constants.ZK_BASE_SLEEP_MS, 1000);
int maxRetries = conf.getInt(Constants.ZK_MAX_RETRIES, 3);
this.waitIntervalWarn = conf.getLong(Constants.WAIT_INTERVAL_WARN,
TreeLockManager.DEFAULT_WAIT_INTERVAL_WARN);
RetryPolicy retryPolicy = new ExponentialBackoffRetry(baseSleepTimeMs, maxRetries);
// Create a temporary connection to ensure the root is created, then create
// a new connection 'jailed' inside that root to eliminate the need for
// paths to constantly be resolved inside the root.
String zookeeperConnectionString = conf.get(Constants.ZK_CONN_STRING);
// Fallback to the HBase ZK quorum.
if (zookeeperConnectionString == null) {
zookeeperConnectionString = conf.get("hbase.zookeeper.quorum");
}
curator = CuratorFrameworkFactory.newClient(zookeeperConnectionString, retryPolicy);
curator.start();
waitForCuratorToConnect();
setRoot();
try {
ZKPaths.mkdirs(curator.getZookeeperClient().getZooKeeper(), root, true);
} catch (Exception e) {
throw new IOException("Unable to initialize root znodes", e);
}
curator.close();
zookeeperConnectionString += root;
curator = CuratorFrameworkFactory.newClient(zookeeperConnectionString, retryPolicy);
curator.start();
waitForCuratorToConnect();
}