码迷,mamicode.com
首页 > 其他好文 > 详细

Zookeeper连接重试设置

时间:2015-01-22 10:52:08      阅读:110      评论:0      收藏:0      [点我收藏+]

标签:

在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);
}

Zookeeper连接重试设置

标签:

原文地址:http://www.cnblogs.com/wk022/p/4240797.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!