/**
* @throws InterruptedException
* @throws KeeperException
*/
protected void registerNode() throws KeeperException, InterruptedException {
// register and watch node ID
Util.checkThenCreateZooNode(path + "/" + id_path,null,Ids.OPEN_ACL_UNSAFE,CreateMode.PERSISTENT,zoo);
zoo.getChildren(path + "/" + id_path, true); // start watching
byte[] b = (addr.getHostString() + ";" + addr.getPort()).getBytes(); // store the SocketAddress
// special case for EC2 inter-region ring; publish public IP
String public_ip = System.getenv("EC2");
if(public_ip != null){
b = (public_ip + ";" + addr.getPort()).getBytes(); // store the SocketAddress
logger.warn("Publish env(EC2) in zookeeper: " + new String(b) + "!");
}
Util.checkThenCreateZooNode(path + "/" + id_path + "/" + nodeID,b,Ids.OPEN_ACL_UNSAFE,CreateMode.EPHEMERAL, zoo,
new ExceptionListener() {
@Override
public void exceptionThrown(Exception e) {
logger.error("Node ID " + nodeID + " in topology " + topologyID + " already registred!");
}
});
}
TopologyManager.java 文件源码
java
阅读 31
收藏 0
点赞 0
评论 0
项目:URingPaxos
作者:
评论列表
文章目录