/** * 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); } }
/** * 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); } }