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 2022/08/08 12:39:56 UTC

[GitHub] [dubbo] zhaoyunxing92 commented on issue #10419: 同一个注册中心不同namespace注册失败

zhaoyunxing92 commented on issue #10419:
URL: https://github.com/apache/dubbo/issues/10419#issuecomment-1208075564

   主要是`AbstractConfig#equals`方法没有看`parameters`的参数
   https://github.com/apache/dubbo/blob/3.0/dubbo-common/src/main/java/org/apache/dubbo/config/context/AbstractConfigManager.java#L161-L167
   ```java
    if (!(config instanceof ReferenceConfigBase || config instanceof ServiceConfigBase)) {
               for (AbstractConfig value : configsMap.values()) {
                   if (value.equals(config)) {
                       return (T) value;
                   }
               }
           }
   ```
   
   [AbstractConfig#equals](https://github.com/apache/dubbo/blob/3.0/dubbo-common/src/main/java/org/apache/dubbo/config/AbstractConfig.java#L959-L983) 方法列表没有`getParameters()`
   ```java
   public boolean equals(Object obj) {
           if (obj == null || obj.getClass() != this.getClass()) {
               return false;
           }
           if (obj == this) {
               return true;
           }
   
           for (Method method : getAttributedMethods()) {
               // ignore compare 'id' value
               if ("getId".equals(method.getName())) {
                   continue;
               }
               try {
                   Object value1 = method.invoke(this);
                   Object value2 = method.invoke(obj);
                   if (!Objects.equals(value1, value2)) {
                       return false;
                   }
               } catch (Exception e) {
                   throw new IllegalStateException("compare config instances failed", e);
               }
           }
           return true;
       }
   ```
   [MethodUtils.isGetter](https://github.com/apache/dubbo/blob/3.0/dubbo-common/src/main/java/org/apache/dubbo/common/utils/MethodUtils.java#L77)判断返回类型是Map的方法不是get


-- 
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