public static boolean createNodeIfNotExistsAndWatch(ZKWatcher zkw, String znode, byte[] data)
    throws KeeperException {
    boolean ret = true;
    try {
      zkw.getRecoverableZooKeeper().create(znode, data, zkw.createACL(znode),
        CreateMode.PERSISTENT);
    } catch (KeeperException.NodeExistsException nee) {
      ret = false;
    } catch (InterruptedException e) {
      zkw.interruptedException(e);
      return false;
    }
    try {
      zkw.getRecoverableZooKeeper().exists(znode, zkw);
    } catch (InterruptedException e) {
      zkw.interruptedException(e);
      return false;
    }
    return ret;
  }
Creates the specified znode to be a persistent node carrying the specified data. Returns true
if the node was successfully created, false if the node already existed. If the node is created
successfully, a watcher is also set on the node. If the node is not created successfully
because it already exists, this method will also set a watcher on the node but return false. If
there is another problem, a KeeperException will be thrown.
@param zkw   zk reference
@param znode path of node
@param data  data of node
@return true if node created, false if not, watch set in both cases
@throws KeeperException if unexpected zookeeper exception
hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKUtil.java