Exemplo n.º 1
0
 void setLocalAddress(HostAndPort address) throws Exception {
   if (local == null) {
     PersistentNode node =
         new PersistentNode(
             client, CreateMode.EPHEMERAL, false, pathOf(domainName), toBytes(address));
     node.start();
     local = node;
   } else {
     local.setData(toBytes(address));
   }
 }
 @Override
 public void afterStart() {
   String path = ZKPaths.makePath(getZooKeeperPath(), address.toString());
   byte[] data = address.toString().getBytes(US_ASCII);
   node = new PersistentNode(client, CreateMode.EPHEMERAL, false, path, data);
   node.start();
 }
Exemplo n.º 3
0
 HostAndPort getLocalAddress() {
   return (local == null) ? null : toHostAndPort(local.getData());
 }