gpt4 book ai didi

org.apache.hadoop.hbase.zookeeper.ZKUtil.nodeHasChildren()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-16 00:10:40 26 4
gpt4 key购买 nike

本文整理了Java中org.apache.hadoop.hbase.zookeeper.ZKUtil.nodeHasChildren()方法的一些代码示例,展示了ZKUtil.nodeHasChildren()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZKUtil.nodeHasChildren()方法的具体详情如下:
包路径:org.apache.hadoop.hbase.zookeeper.ZKUtil
类名称:ZKUtil
方法名:nodeHasChildren

ZKUtil.nodeHasChildren介绍

[英]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.
[中]检查指定的znode是否有子节点。没有手表。如果节点存在且有子节点,则返回true。如果节点不存在或节点没有任何子节点,则返回false。在主机初始化期间使用,以确定主机是故障转移到主机还是初始群集启动期间的第一个主机。如果regionserver临时节点的目录为空,则这是群集启动,如果不是,则不是群集启动。

代码示例

代码示例来源:origin: co.cask.hbase/hbase

/**
 * Blocks until there are no node in regions in transition.
 * <p>
 * Used in testing only.
 * @param zkw zk reference
 * @throws KeeperException
 * @throws InterruptedException
 */
public static void blockUntilNoRIT(ZooKeeperWatcher zkw)
throws KeeperException, InterruptedException {
 while (ZKUtil.nodeHasChildren(zkw, zkw.assignmentZNode)) {
  List<String> znodes =
   ZKUtil.listChildrenAndWatchForNewChildren(zkw, zkw.assignmentZNode);
  if (znodes != null && !znodes.isEmpty()) {
   for (String znode : znodes) {
    LOG.debug("ZK RIT -> " + znode);
   }
  }
  Thread.sleep(100);
 }
}

代码示例来源:origin: co.cask.hbase/hbase

/**
 * Blocks until there is at least one node in regions in transition.
 * <p>
 * Used in testing only.
 * @param zkw zk reference
 * @throws KeeperException
 * @throws InterruptedException
 */
public static void blockUntilRIT(ZooKeeperWatcher zkw)
throws KeeperException, InterruptedException {
 while (!ZKUtil.nodeHasChildren(zkw, zkw.assignmentZNode)) {
  List<String> znodes =
   ZKUtil.listChildrenAndWatchForNewChildren(zkw, zkw.assignmentZNode);
  if (znodes == null || znodes.isEmpty()) {
   LOG.debug("No RIT in ZK");
  }
  Thread.sleep(100);
 }
}

代码示例来源:origin: harbby/presto-connectors

/**
 * Blocks until there are no node in regions in transition.
 * <p>
 * Used in testing only.
 * @param zkw zk reference
 * @throws KeeperException
 * @throws InterruptedException
 */
public static void blockUntilNoRIT(ZooKeeperWatcher zkw)
throws KeeperException, InterruptedException {
 while (ZKUtil.nodeHasChildren(zkw, zkw.assignmentZNode)) {
  List<String> znodes =
   ZKUtil.listChildrenAndWatchForNewChildren(zkw, zkw.assignmentZNode);
  if (znodes != null && !znodes.isEmpty()) {
   LOG.debug("Waiting on RIT: " + znodes);
  }
  Thread.sleep(100);
 }
}

代码示例来源:origin: harbby/presto-connectors

/**
 * Blocks until there is at least one node in regions in transition.
 * <p>
 * Used in testing only.
 * @param zkw zk reference
 * @throws KeeperException
 * @throws InterruptedException
 */
public static void blockUntilRIT(ZooKeeperWatcher zkw)
throws KeeperException, InterruptedException {
 while (!ZKUtil.nodeHasChildren(zkw, zkw.assignmentZNode)) {
  List<String> znodes =
   ZKUtil.listChildrenAndWatchForNewChildren(zkw, zkw.assignmentZNode);
  if (znodes == null || znodes.isEmpty()) {
   LOG.debug("No RIT in ZK");
  }
  Thread.sleep(100);
 }
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com