public static int getNumberOfChildren(ZKWatcher zkw, String znode) throws KeeperException {
    try {
      Stat stat = zkw.getRecoverableZooKeeper().exists(znode, null);
      return stat == null ? 0 : stat.getNumChildren();
    } catch (KeeperException e) {
      LOG.warn(zkw.prefix("Unable to get children of node " + znode));
      zkw.keeperException(e);
    } catch (InterruptedException e) {
      zkw.interruptedException(e);
    }
    return 0;
  }
Get the number of children of the specified node. If the node does not exist or has no
children, returns 0. Sets no watches at all.
@param zkw   zk reference
@param znode path of node to count children of
@return number of children of specified node, 0 if none or parent does not exist
@throws KeeperException if unexpected zookeeper exception
hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKUtil.java