zrlw commented on code in PR #15633:
URL: https://github.com/apache/dubbo/pull/15633#discussion_r2278100335


##########
dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/DefaultServiceInstance.java:
##########
@@ -305,21 +306,29 @@ public boolean equals(Object o) {
             return false;
         }
         DefaultServiceInstance that = (DefaultServiceInstance) o;
-        boolean equals = Objects.equals(getServiceName(), 
that.getServiceName())
-                && Objects.equals(getHost(), that.getHost())
-                && Objects.equals(getPort(), that.getPort());
+        if (!Objects.equals(getServiceName(), that.getServiceName())
+                || !Objects.equals(getHost(), that.getHost())
+                || !Objects.equals(getPort(), that.getPort())) {
+            return false;
+        }
+
         for (Map.Entry<String, String> entry : this.getMetadata().entrySet()) {
-            if 
(entry.getKey().equals(EXPORTED_SERVICES_REVISION_PROPERTY_NAME)) {
+            if (entry.getKey().equals(EXPORTED_SERVICES_REVISION_PROPERTY_NAME)
+                    || entry.getKey().equals(TIMESTAMP_KEY)) {
                 continue;
             }
             if (entry.getValue() == null) {
-                equals = equals && (entry.getValue() == 
that.getMetadata().get(entry.getKey()));
+                if (null != that.getMetadata().get(entry.getKey())) {
+                    return false;
+                }
             } else {
-                equals = equals && 
entry.getValue().equals(that.getMetadata().get(entry.getKey()));
+                if 
(!entry.getValue().equals(that.getMetadata().get(entry.getKey()))) {
+                    return false;
+                }
             }
         }
 
-        return equals;
+        return true;

Review Comment:
   other instance metadata verification added.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to