private void waitForNewProcedures() {
   // watch for new procedues that we need to start subprocedures for
   LOG.debug("Looking for new procedures under znode:'" + zkController.getAcquiredBarrier() + "'");
   List<String> runningProcedures = null;
   try {
     runningProcedures =
         ZKUtil.listChildrenAndWatchForNewChildren(
             zkController.getWatcher(), zkController.getAcquiredBarrier());
     if (runningProcedures == null) {
       LOG.debug("No running procedures.");
       return;
     }
   } catch (KeeperException e) {
     member.controllerConnectionFailure(
         "General failure when watching for new procedures", e, null);
   }
   if (runningProcedures == null) {
     LOG.debug("No running procedures.");
     return;
   }
   for (String procName : runningProcedures) {
     // then read in the procedure information
     String path = ZKUtil.joinZNode(zkController.getAcquiredBarrier(), procName);
     startNewSubprocedure(path);
   }
 }
 /**
  * Get the list of all the region servers from the specified peer
  *
  * @param zkw zk connection to use
  * @return list of region server addresses or an empty list if the slave is unavailable
  */
 private static List<ServerName> fetchSlavesAddresses(ZooKeeperWatcher zkw)
     throws KeeperException {
   List<String> children = ZKUtil.listChildrenAndWatchForNewChildren(zkw, zkw.rsZNode);
   if (children == null) {
     return Collections.emptyList();
   }
   List<ServerName> addresses = new ArrayList<ServerName>(children.size());
   for (String child : children) {
     addresses.add(ServerName.parseServerName(child));
   }
   return addresses;
 }
 private void watchForAbortedProcedures() {
   LOG.debug("Checking for aborted procedures on node: '" + zkController.getAbortZnode() + "'");
   try {
     // this is the list of the currently aborted procedues
     for (String node :
         ZKUtil.listChildrenAndWatchForNewChildren(
             zkController.getWatcher(), zkController.getAbortZnode())) {
       String abortNode = ZKUtil.joinZNode(zkController.getAbortZnode(), node);
       abort(abortNode);
     }
   } catch (KeeperException e) {
     member.controllerConnectionFailure(
         "Failed to list children for abort node:" + zkController.getAbortZnode(), e, null);
   }
 }
 private List<String> getTaskList() throws InterruptedException {
   List<String> childrenPaths = null;
   long sleepTime = 1000;
   // It will be in loop till it gets the list of children or
   // it will come out if worker thread exited.
   while (!shouldStop) {
     try {
       childrenPaths = ZKUtil.listChildrenAndWatchForNewChildren(watcher, watcher.splitLogZNode);
       if (childrenPaths != null) {
         return childrenPaths;
       }
     } catch (KeeperException e) {
       LOG.warn("Could not get children of znode " + watcher.splitLogZNode, e);
     }
     LOG.debug(
         "Retry listChildren of znode "
             + watcher.splitLogZNode
             + " after sleep for "
             + sleepTime
             + "ms!");
     Thread.sleep(sleepTime);
   }
   return childrenPaths;
 }