reta commented on code in PR #2571: URL: https://github.com/apache/cxf/pull/2571#discussion_r2333857310
########## rt/transports/http/src/main/java/org/apache/cxf/transport/http/HttpClientHTTPConduit.java: ########## @@ -195,14 +207,22 @@ RefCount<HttpClient> computeIfAbsent(final boolean shareHttpClient, final HTTPCl // Do not share if it is not allowed for the conduit or cache capacity is exceeded if (!shareHttpClient || clients.size() >= MAX_SIZE) { - return new RefCount<HttpClient>(supplier.get(), policy, clientParameters, () -> { }).acquire(); + return new RefCount<HttpClient>(supplier.get(), policy, clientParameters, () -> { }); } lock.lock(); try { for (final RefCount<HttpClient> p: clients) { - if (cpc.equals(p.policy(), policy) && p.clientParameters().equals(clientParameters)) { - return p.acquire(); + try { Review Comment: I think this is fine as well, the outer `try` in only to fail fast (we usually only have on client per that matches `cpc.equals(p.policy(), policy) && p.clientParameters().equals(clientParameters))` , thanks @ffang ! ########## rt/transports/http/src/main/java/org/apache/cxf/transport/http/HttpClientHTTPConduit.java: ########## @@ -195,14 +207,22 @@ RefCount<HttpClient> computeIfAbsent(final boolean shareHttpClient, final HTTPCl // Do not share if it is not allowed for the conduit or cache capacity is exceeded if (!shareHttpClient || clients.size() >= MAX_SIZE) { - return new RefCount<HttpClient>(supplier.get(), policy, clientParameters, () -> { }).acquire(); + return new RefCount<HttpClient>(supplier.get(), policy, clientParameters, () -> { }); } lock.lock(); try { for (final RefCount<HttpClient> p: clients) { - if (cpc.equals(p.policy(), policy) && p.clientParameters().equals(clientParameters)) { - return p.acquire(); + try { Review Comment: I think this is fine as well, the outer `try` was only to fail fast (we usually only have on client per that matches `cpc.equals(p.policy(), policy) && p.clientParameters().equals(clientParameters))` , thanks @ffang ! -- 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: dev-unsubscr...@cxf.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org