Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
去掉ZookeeperRegistry 中对zkclient的显示依赖
  • Loading branch information
bohrqiu committed Sep 26, 2013
1 parent 9109e91 commit fcb1ca6
Showing 1 changed file with 0 additions and 6 deletions.
Expand Up @@ -21,8 +21,6 @@
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

import org.I0Itec.zkclient.exception.ZkNoNodeException;

import com.alibaba.dubbo.common.Constants;
import com.alibaba.dubbo.common.URL;
import com.alibaba.dubbo.common.logger.Logger;
Expand Down Expand Up @@ -193,14 +191,10 @@ public List<URL> lookup(URL url) {
try {
List<String> providers = new ArrayList<String>();
for (String path : toCategoriesPath(url)) {
try {
List<String> children = zkClient.getChildren(path);
if (children != null) {
providers.addAll(children);
}
} catch (ZkNoNodeException e) {
// ignore
}
}
return toUrlsWithoutEmpty(url, providers);
} catch (Throwable e) {
Expand Down

4 comments on commit fcb1ca6

@wuwen5
Copy link
Contributor

@wuwen5 wuwen5 commented on fcb1ca6 Mar 15, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

有个疑问,原本捕获的异常是在循环内部,当一个path失败的时候不会退出,这里直接去掉了会不会导致一个节点获取失败就退出了?

@wuwen5
Copy link
Contributor

@wuwen5 wuwen5 commented on fcb1ca6 Mar 15, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bohrqiu
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

应该有可能。。。。

@xiaozhen57520
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

public List<String> getChildren(String path) {
       try {
        return client.getChildren(path);
        } catch (ZkNoNodeException e) {
            return null;
        }
}

这是ZkclientZookeeperClient的实现,内部已经对ZkNoNodeException捕获了,所以去掉不会有问题。
@wuwen5 @bohrqiu

Please sign in to comment.