Fix connection-pool-size 0 being ignored and being unable to disable the connection pool

This commit is contained in:
mauritsdebruin 2023-04-28 14:54:24 +02:00 committed by Pedro Igor
parent ccbddb2258
commit 8c7a08e580
2 changed files with 4 additions and 8 deletions

View file

@ -427,13 +427,11 @@ public class HttpClientBuilder {
throw new RuntimeException("Failed to load keystore", e); throw new RuntimeException("Failed to load keystore", e);
} }
} }
int size = 10;
if (adapterConfig.getConnectionPoolSize() > 0)
size = adapterConfig.getConnectionPoolSize();
HttpClientBuilder.HostnameVerificationPolicy policy = HttpClientBuilder.HostnameVerificationPolicy.WILDCARD; HttpClientBuilder.HostnameVerificationPolicy policy = HttpClientBuilder.HostnameVerificationPolicy.WILDCARD;
if (adapterConfig.isAllowAnyHostname()) if (adapterConfig.isAllowAnyHostname())
policy = HttpClientBuilder.HostnameVerificationPolicy.ANY; policy = HttpClientBuilder.HostnameVerificationPolicy.ANY;
connectionPoolSize(size); connectionPoolSize(adapterConfig.getConnectionPoolSize());
hostnameVerification(policy); hostnameVerification(policy);
if (adapterConfig.isDisableTrustManager()) { if (adapterConfig.isDisableTrustManager()) {
disableTrustManager(); disableTrustManager();

View file

@ -359,13 +359,11 @@ public class HttpClientBuilder {
throw new RuntimeException("Failed to load keystore", e); throw new RuntimeException("Failed to load keystore", e);
} }
} }
int size = 10;
if (adapterConfig.getConnectionPoolSize() > 0)
size = adapterConfig.getConnectionPoolSize();
HttpClientBuilder.HostnameVerificationPolicy policy = HttpClientBuilder.HostnameVerificationPolicy.WILDCARD; HttpClientBuilder.HostnameVerificationPolicy policy = HttpClientBuilder.HostnameVerificationPolicy.WILDCARD;
if (adapterConfig.isAllowAnyHostname()) if (adapterConfig.isAllowAnyHostname())
policy = HttpClientBuilder.HostnameVerificationPolicy.ANY; policy = HttpClientBuilder.HostnameVerificationPolicy.ANY;
connectionPoolSize(size); connectionPoolSize(adapterConfig.getConnectionPoolSize());
hostnameVerification(policy); hostnameVerification(policy);
if (adapterConfig.isDisableTrustManager()) { if (adapterConfig.isDisableTrustManager()) {
disableTrustManager(); disableTrustManager();