xianjingfeng commented on code in PR #2442:
URL: https://github.com/apache/uniffle/pull/2442#discussion_r2043381359


##########
internal-client/src/main/java/org/apache/uniffle/client/factory/ShuffleServerClientFactory.java:
##########
@@ -59,20 +59,18 @@ private ShuffleServerClient createShuffleServerClient(
     }
   }
 
-  public synchronized ShuffleServerClient getShuffleServerClient(
+  public ShuffleServerClient getShuffleServerClient(
       String clientType, ShuffleServerInfo shuffleServerInfo) {
     return getShuffleServerClient(clientType, shuffleServerInfo, new 
RssConf());
   }
 
-  public synchronized ShuffleServerClient getShuffleServerClient(
+  public ShuffleServerClient getShuffleServerClient(
       String clientType, ShuffleServerInfo shuffleServerInfo, RssConf rssConf) 
{
-    clients.putIfAbsent(clientType, JavaUtils.newConcurrentMap());
-    Map<ShuffleServerInfo, ShuffleServerClient> serverToClients = 
clients.get(clientType);
-    if (serverToClients.get(shuffleServerInfo) == null) {
-      serverToClients.put(
-          shuffleServerInfo, createShuffleServerClient(clientType, 
shuffleServerInfo, rssConf));
-    }
-    return serverToClients.get(shuffleServerInfo);
+    Map<ShuffleServerInfo, ShuffleServerClient> serverToClients =
+        clients.computeIfAbsent(clientType, key -> 
JavaUtils.newConcurrentMap());
+    return serverToClients.computeIfAbsent(

Review Comment:
   @summaryzb In your solution, will there be any problem with the following 
situation?
   Thread1: client = cache.get
   Thread2(RemovalListener): client.close()
   Thread1(after expireTime): client.rpcrequest() 



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