コード例 #1
0
 /**
  * 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;
 }
コード例 #2
0
 /** 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;
 }
コード例 #3
0
ファイル: PgPortTracker.java プロジェクト: 4399data/Lealone
 @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);
     }
   }
 }
コード例 #4
0
ファイル: PgPortTracker.java プロジェクト: 4399data/Lealone
 public void start() throws KeeperException, IOException {
   watcher.registerListener(this);
   List<String> servers = ZKUtil.listChildrenAndWatchThem(watcher, ZooKeeperAdmin.PG_SERVER_NODE);
   add(servers);
 }