public static boolean setWatchIfNodeExists(ZKWatcher zkw, String znode) throws KeeperException {
    try {
      zkw.getRecoverableZooKeeper().getData(znode, true, null);
      return true;
    } catch (NoNodeException e) {
      return false;
    } catch (InterruptedException e) {
      LOG.warn(zkw.prefix("Unable to set watcher on znode " + znode), e);
      zkw.interruptedException(e);
      return false;
    }
  }
Watch the specified znode, but only if exists. Useful when watching for deletions. Uses
.getData() (and handles NoNodeException) instead of .exists() to accomplish this, as .getData()
will only set a watch if the znode exists.
@param zkw   zk reference
@param znode path of node to watch
@return true if the watch is set, false if node does not exists
@throws KeeperException if unexpected zookeeper exception
hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKUtil.java