public static boolean watchAndCheckExists(ZooKeeperWatcher zkw, String zNode)
            throws KeeperException {
        try {
            Stat s = zkw.getRecoverableZooKeeper().exists(zNode, zkw);
            boolean exists = (s != null);
            if (logger.isDebugEnabled()) {
                if (exists) {
                    logger.debug(zkw.prefix("Set watcher on existing zNode " + zNode));
                } else {
                    logger.debug(zkw.prefix(zNode + " does not exist. Watcher is set."));
                }
            }
            return exists;
        } catch (KeeperException e) {
            logger.warn(zkw.prefix("Unable to set watcher on zNode " + zNode), e);
            zkw.keeperException(e);
            return false;
        } catch (InterruptedException e) {
            logger.warn(zkw.prefix("Unable to set watcher on zNode " + zNode), e);
            zkw.interruptedException(e);
            return false;
        }
    }
Watch the specified zNode for delete/create/change events. The watcher is
set whether or not the node exists. If the node already exists, the method
returns true. If the node does not exist, the method returns false.

@param zkw
         zk reference
@param zNode
         path of node to watch
@return true if zNode exists, false if does not exist or error
@throws KeeperException
          if unexpected zookeeper exception
inlong-tubemq/tubemq-server/src/main/java/org/apache/inlong/tubemq/server/common/zookeeper/ZKUtil.java