[ https://issues.apache.org/jira/browse/CXF-9109?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17930886#comment-17930886 ]
Andriy Redko commented on CXF-9109: ----------------------------------- Thanks [~shpelda] and [~rkraus] > I am sorry, but I don't understand why {{HTTPClientPolicy}} is used as map >key (even without redefined {{{}equals(){}}}/{{{}hashCode(){}}} methods). CXF create {{HTTPClientPolicy}} per conduit, in this case the key is relying on reference equality (same policy instance), not per-fields equality. > In addition, there is a comment ({{{}AsyncHTTPConduitFactory{}}}), {_}... the > context propagation is necessary to remove per-HTTPClientPolicy caching{_}, > but HTTPCLIENT-2209 has already introduced {{HttpContext}} propagation. This is correct, I think I've tried to re-implement that but run into the issue that too many classes were not accessible (package private), I will revisit it shortly. > MAX_PER_HOST_CONNECTIONS does not work > -------------------------------------- > > Key: CXF-9109 > URL: https://issues.apache.org/jira/browse/CXF-9109 > Project: CXF > Issue Type: Bug > Components: JAX-RS > Affects Versions: 4.1.0 > Reporter: shpelda > Priority: Major > Attachments: ConnectionPoolingTest.java > > > After migration from 3.4.4 to 4.1.0, one of my tests started crashing. > In v3, AsyncHTTPConduitFactory used shared ConnectionManager, so that > bus-level properties > _org.apache.cxf.transport.http.async.MAX_CONNECTIONS_ and > _org.apache.cxf.transport.http.async.MAX_PER_HOST_CONNECTIONS_ > worked across clients. > This properties were the reason why I used the AsyncHTTPConduitFactory, as i > had to limit count of created connections. > > v3 implementation of AsyncHTTPConduitFactory used shared instance of client > and connectionManager, which finally caused above properties to work properly. > hc5.AsyncHTTPConduitFactory(correctly) maintains cache of > httpclientPolicy->httpClient. > However _PoolingAsyncClientConnectionManager_ must not created with each > client, but must be shared. Should be owned by the {_}Bus{_}. > Otherwise connection pool cannot work correctly. -- This message was sent by Atlassian Jira (v8.20.10#820010)