You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2021/09/30 02:11:17 UTC

[GitHub] [dubbo] FinalVersion commented on a change in pull request #8899: [master] Fix-#8506 MultipleRegistry remove duplicate URL

FinalVersion commented on a change in pull request #8899:
URL: https://github.com/apache/dubbo/pull/8899#discussion_r719005623



##########
File path: dubbo-registry/dubbo-registry-multiple/src/main/java/org/apache/dubbo/registry/multiple/MultipleRegistry.java
##########
@@ -205,14 +206,14 @@ public void unsubscribe(URL url, NotifyListener listener) {
 
     @Override
     public List<URL> lookup(URL url) {
-        List<URL> urls = new ArrayList<URL>();
+        List<URL> urls = new ArrayList<>();
         for (Registry registry : referenceRegistries.values()) {
             List<URL> tmpUrls = registry.lookup(url);
             if (!CollectionUtils.isEmpty(tmpUrls)) {
                 urls.addAll(tmpUrls);
             }
         }
-        return urls;
+        return urls.stream().distinct().collect(Collectors.toList());

Review comment:
       @wangchengming666 @AlbumenJ @pinxiong 
   这个实现可能有两个问题:
   1. 同一个实例在不同注册中心上的url可能有部分parameter是不同的,比如我们测试下来,同时注册nacos和zookeeper时,nacos比zookeeper的url多`path`,`protocol`,`category`三个parameter。用URL#equals比较仍然会有重复实例。
   2. 通过notify变更通知的时候也需要处理重复实例问题。
   
   https://github.com/apache/dubbo/pull/8508 已经处理了这两个问题,不过采用什么标准来判断两个url是否为同一个实例可能需要斟酌一下




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org