修改zookeeper实现

git-svn-id: http://code.alibabatech.com/svn/dubbo/trunk@70 1a56cb94-b969-4eaa-88fa-be21384802f2
This commit is contained in:
william.liangf 2011-10-26 06:46:26 +00:00
parent 74c0ae95dc
commit 30bdf6ae08
1 changed files with 6 additions and 1 deletions

View File

@ -61,7 +61,12 @@ public class ZookeeperRegistry implements Registry {
public ZookeeperRegistry(URL url) {
this.url = url;
try {
this.zookeeper = new ZooKeeper(url.getAddress(), url.getPositiveIntParameter(
String address = url.getAddress();
String backup = url.getParameter(Constants.BACKUP_KEY);
if (backup != null && backup.length() > 0) {
address = address + "," + backup;
}
this.zookeeper = new ZooKeeper(address, url.getPositiveIntParameter(
Constants.TIMEOUT_KEY, 5000), new Watcher() {
public void process(WatchedEvent event) {
}