Ejemplo n.º 1
0
 @Override
 public Host getHostByAddress(PartitionServerAddress address) {
   for (ZkHost host : hosts.values()) {
     if (host.getAddress().equals(address)) {
       return host;
     }
   }
   return null;
 }
Ejemplo n.º 2
0
 @Override
 public boolean removeHost(PartitionServerAddress address) throws IOException {
   for (Map.Entry<String, ZkHost> entry : hosts.entrySet()) {
     if (entry.getValue().getAddress().equals(address)) {
       ZkHost host = hosts.remove(entry.getKey());
       host.delete();
       fireDataLocationChangeListener();
       return true;
     }
   }
   return false;
 }
Ejemplo n.º 3
0
 @Override
 public Host addHost(PartitionServerAddress address, List<String> flags) throws IOException {
   try {
     return ZkHost.create(
         zk,
         coordinator,
         ZkPath.append(ringPath, HOSTS_PATH_SEGMENT),
         address,
         dataLocationChangeListener,
         flags);
   } catch (Exception e) {
     throw new IOException(e);
   }
 }
Ejemplo n.º 4
0
 public void close() {
   for (Host host : getHosts()) {
     ((ZkHost) host).close();
   }
 }