jonyangx commented on code in PR #2848:
URL: 
https://github.com/apache/incubator-eventmesh/pull/2848#discussion_r1063890098


##########
eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/tcp/client/recommend/EventMeshRecommendImpl.java:
##########
@@ -226,15 +228,16 @@ private String recommendProxy(final Map<String, String> 
eventMeshMap,
             log.info("eventMeshMap:{},clientDistributionMap:{},group:{}", 
eventMeshMap, clientDistributionMap, group);
         }
 
-        if 
(!eventMeshMap.keySet().containsAll(clientDistributionMap.keySet())) {
+        Set<String> clientdDistributionSet=new 
HashSet<>(clientDistributionMap.keySet());
+        clientdDistributionSet.retainAll(eventMeshMap.keySet());

Review Comment:
   Retains only the elements in this collection that are contained in the 
specified collection (optional operation). In other words, removes from this 
collection all of its elements that are not contained in the specified 
collection.
   This implementation iterates over this collection, checking each element 
returned by the iterator in turn to see if it's contained in the specified 
collection. If it's not so contained, it's removed from this collection with 
the iterator's remove method.
   I think Iteration over keyset can not be avoided ,but add remove operation.



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