ffang commented on code in PR #3725:
URL: https://github.com/apache/cxf/pull/3725#discussion_r4605067214


##########
rt/transports/http-hc5/src/main/java/org/apache/cxf/transport/http/asyncclient/hc5/AsyncHTTPConduitFactory.java:
##########
@@ -144,7 +143,8 @@ public PoolingAsyncClientConnectionManager 
getConnectionManager() {
         }
     }
 
-    private volatile Map<HTTPClientPolicy, AsyncClient> clients = new 
ConcurrentHashMap<>();
+    // the clients of the conduits, to shut them down with the factory
+    private final Map<CloseableHttpAsyncClient, AsyncClient> clients = new 
ConcurrentHashMap<>();

Review Comment:
   Hi @reta,
   
   Yes, it's 1:1 now. The map is there because a conduit only holds the 
`CloseableHttpAsyncClient` (`createClient()` is public and returns it), while 
the factory needs the `AsyncClient` for:
   
   - `shutdown()` (bus shutdown) and `update()` with a reactor setting changed: 
these shut down the clients of all live conduits, including conduits that are 
never closed, as before;
   - `setProperties()`: it applies new `MAX_CONNECTIONS` / 
`MAX_PER_HOST_CONNECTIONS` values to the connection managers of the live 
clients;
   - `release()`: closes the connection manager along with the client.
   
   So the map is a registry of live clients, and its key lets `release()` find 
the `AsyncClient` from what the conduit holds. We could drop the key by making 
`createClient()` return `AsyncClient` and keeping a `Set<AsyncClient>`, but 
that changes a public signature, which I wanted to avoid for the 4.2.x branch. 
I'll reword the comment on the field to say this. Or would you prefer the `Set` 
version?
   
   Thanks!
   Freeman



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

Reply via email to