xianjingfeng commented on code in PR #2442:
URL: https://github.com/apache/uniffle/pull/2442#discussion_r2046236351
##########
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:
> There is no chance to happen, the lock mechanism is guaranteed by
`CaffeineCache` or `GuavaCache`, thread1 and thread2 can not operate the same
client
I don't understand what you mean. Do you mean that if thread-1 gets the
client from the cache and uses it until the JVM exits, the client will not be
closed before the JVM exits? Even if the client expires in the cache?
--
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]