HTTPCLIENT-2315: client builders fails to apply system properties to the default connection manager

This commit is contained in:
Oleg Kalnichevski 2024-01-08 14:24:36 +01:00
parent 8228ddf28a
commit ef77109f35
2 changed files with 10 additions and 2 deletions

View File

@ -779,7 +779,11 @@ protected void addCloseable(final Closeable closeable) {
public CloseableHttpAsyncClient build() {
AsyncClientConnectionManager connManagerCopy = this.connManager;
if (connManagerCopy == null) {
connManagerCopy = PoolingAsyncClientConnectionManagerBuilder.create().build();
final PoolingAsyncClientConnectionManagerBuilder connectionManagerBuilder = PoolingAsyncClientConnectionManagerBuilder.create();
if (systemProperties) {
connectionManagerBuilder.useSystemProperties();
}
connManagerCopy = connectionManagerBuilder.build();
}
ConnectionKeepAliveStrategy keepAliveStrategyCopy = this.keepAliveStrategy;

View File

@ -751,7 +751,11 @@ public CloseableHttpClient build() {
}
HttpClientConnectionManager connManagerCopy = this.connManager;
if (connManagerCopy == null) {
connManagerCopy = PoolingHttpClientConnectionManagerBuilder.create().build();
final PoolingHttpClientConnectionManagerBuilder connectionManagerBuilder = PoolingHttpClientConnectionManagerBuilder.create();
if (systemProperties) {
connectionManagerBuilder.useSystemProperties();
}
connManagerCopy = connectionManagerBuilder.build();
}
ConnectionReuseStrategy reuseStrategyCopy = this.reuseStrategy;
if (reuseStrategyCopy == null) {