You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by al...@apache.org on 2021/07/21 02:41:57 UTC

[dubbo] branch 3.0 updated: Use TreeSet to ensure ServiceNames order (#8326)

This is an automated email from the ASF dual-hosted git repository.

albumenj pushed a commit to branch 3.0
in repository https://gitbox.apache.org/repos/asf/dubbo.git


The following commit(s) were added to refs/heads/3.0 by this push:
     new e2079ac  Use TreeSet to ensure ServiceNames order (#8326)
e2079ac is described below

commit e2079ac536b30e59a9268127db85f08ad40790a8
Author: Albumen Kevin <jh...@gmail.com>
AuthorDate: Wed Jul 21 10:41:08 2021 +0800

    Use TreeSet to ensure ServiceNames order (#8326)
---
 .../java/org/apache/dubbo/registry/client/ServiceDiscoveryRegistry.java | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/ServiceDiscoveryRegistry.java b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/ServiceDiscoveryRegistry.java
index 9937357..bbe98a3 100644
--- a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/ServiceDiscoveryRegistry.java
+++ b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/ServiceDiscoveryRegistry.java
@@ -41,6 +41,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Objects;
 import java.util.Set;
+import java.util.TreeSet;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.stream.Collectors;
 
@@ -292,6 +293,7 @@ public class ServiceDiscoveryRegistry implements Registry {
     }
 
     protected void subscribeURLs(URL url, NotifyListener listener, Set<String> serviceNames) {
+        serviceNames = new TreeSet<>(serviceNames);
         String serviceNamesKey = toStringKeys(serviceNames);
         String protocolServiceKey = url.getServiceKey() + GROUP_CHAR_SEPARATOR + url.getParameter(PROTOCOL_KEY, DUBBO);