标签:
在ZKUtil.java中:
public static RecoverableZooKeeper connect(Configuration conf, String ensemble,
Watcher watcher, final String identifier)
throws IOException {
if(ensemble == null) {
throw new IOException("Unable to determine ZooKeeper ensemble");
}
int timeout = conf.getInt(HConstants.ZK_SESSION_TIMEOUT,
HConstants.DEFAULT_ZK_SESSION_TIMEOUT);
if (LOG.isTraceEnabled()) {
LOG.trace(identifier + " opening connection to ZooKeeper ensemble=" + ensemble);
}
int retry = conf.getInt("zookeeper.recovery.retry", 3);//zookeeper连接重试次数
int retryIntervalMillis =
conf.getInt("zookeeper.recovery.retry.intervalmill", 1000);//zookeeper连接重试间隔
zkDumpConnectionTimeOut = conf.getInt("zookeeper.dump.connection.timeout",
1000);
return new RecoverableZooKeeper(ensemble, timeout, watcher,
retry, retryIntervalMillis, identifier);
}
标签:
原文地址:http://www.cnblogs.com/wk022/p/4240797.html