public static boolean nodeHasChildren(ZKWatcher zkw, String znode) throws KeeperException {
    try {
      return !zkw.getRecoverableZooKeeper().getChildren(znode, null).isEmpty();
    } catch (KeeperException.NoNodeException ke) {
      LOG.debug(zkw.prefix("Unable to list children of znode " + znode
        + " because node does not exist (not an error)"));
      return false;
    } catch (KeeperException e) {
      LOG.warn(zkw.prefix("Unable to list children of znode " + znode), e);
      zkw.keeperException(e);
      return false;
    } catch (InterruptedException e) {
      LOG.warn(zkw.prefix("Unable to list children of znode " + znode), e);
      zkw.interruptedException(e);
      return false;
    }
  }
Checks if the specified znode has any children. Sets no watches. Returns true if the node
exists and has children. Returns false if the node does not exist or if the node does not have
any children. Used during master initialization to determine if the master is a failed-over-to
master or the first master during initial cluster startup. If the directory for regionserver
ephemeral nodes is empty then this is a cluster startup, if not then it is not cluster startup.
@param zkw   zk reference
@param znode path of node to check for children of
@return true if node has children, false if not or node does not exist
@throws KeeperException if unexpected zookeeper exception
hbase-zookeeper/src/main/java/org/apache/hadoop/hbase/zookeeper/ZKUtil.java