code: @VisibleForTesting
    public static void prepareBookKeeperEnv(final String availablePath,
        ZooKeeper zooKeeper) throws IOException {
      final CountDownLatch availablePathLatch =  new CountDownLatch(1);
      StringCallback cb = new StringCallback() {
        @Override
        public void processResult(int rc, String path, Object ctx, String name) {
          if (Code.OK.intValue() == rc || Code.NODEEXISTS.intValue() == rc) {
            availablePathLatch.countDown();
            LOG.info("Successfully created bookie available path:" +
                availablePath);
          } else {
            Code code = Code.get(rc);
            LOG.error("Failed to create available bookie path (" +
                availablePath + ")", KeeperException.create(code, path));
          }
        }
      };
      ZkUtils.createFullPathOptimistic(zooKeeper, availablePath, new byte[0],
          Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT, cb, null);
      try {
        int timeoutMs = zooKeeper.getSessionTimeout();
        if (!availablePathLatch.await(timeoutMs, TimeUnit.MILLISECONDS)) {
          throw new IOException("Couldn't create the bookie available path : " +
              availablePath + ", timed out after " + timeoutMs + " ms.");
        }
      } catch (InterruptedException e) {
        Thread.currentThread().interrupt();
        throw new IOException("Interrupted when creating the bookie available " +
            "path: " + availablePath, e);
      }
    }
docs: Create parent ZNode under which available BookKeeper bookie servers will
  register themselves. Will create parent ZNodes for that path as well.
  @see ZkUtils#createFullPathOptimistic(ZooKeeper, String, byte[], List, CreateMode, StringCallback, Object)
  @param availablePath Full ZooKeeper path for bookies to register
  themselves.
  @param zooKeeper Fully instantiated ZooKeeper instance.
  @throws IOException If we are unable to successfully create the path
  during the time specified as the ZooKeeper session
  timeout.