/**
  * Get a list of all the other region servers in this cluster and set a watch
  *
  * @return a list of server nanes
  */
 private List<String> getRegisteredRegionServers() {
   List<String> result = null;
   try {
     result = ZKUtil.listChildrenAndWatchThem(this.zookeeper, this.zookeeper.rsZNode);
   } catch (KeeperException e) {
     this.abortable.abort("Get list of registered region servers", e);
   }
   return result;
 }
 /** List all registered peer clusters and set a watch on their znodes. */
 @Override
 public List<String> getAllPeerIds() {
   List<String> ids = null;
   try {
     ids = ZKUtil.listChildrenAndWatchThem(this.zookeeper, this.peersZNode);
   } catch (KeeperException e) {
     this.abortable.abort("Cannot get the list of peers ", e);
   }
   return ids;
 }
Example #3
0
 @Override
 public void nodeChildrenChanged(String path) {
   if (path.equals(ZooKeeperAdmin.PG_SERVER_NODE)) {
     try {
       List<String> servers =
           ZKUtil.listChildrenAndWatchThem(watcher, ZooKeeperAdmin.PG_SERVER_NODE);
       add(servers);
     } catch (IOException e) {
       abortable.abort("Unexpected zk exception getting server nodes", e);
     } catch (KeeperException e) {
       abortable.abort("Unexpected zk exception getting server nodes", e);
     }
   }
 }
Example #4
0
 public void start() throws KeeperException, IOException {
   watcher.registerListener(this);
   List<String> servers = ZKUtil.listChildrenAndWatchThem(watcher, ZooKeeperAdmin.PG_SERVER_NODE);
   add(servers);
 }