Use setDefaultConnectionConfig instead of deprecated method setValidateAfterInactivity.

This commit is contained in:
Arturo Bernal 2021-08-27 07:06:49 +02:00 committed by Oleg Kalnichevski
parent 755b69ea3c
commit 1eeca062f2
1 changed files with 4 additions and 1 deletions

View File

@ -35,6 +35,7 @@ import org.apache.hc.client5.http.auth.Credentials;
import org.apache.hc.client5.http.auth.CredentialsStore; import org.apache.hc.client5.http.auth.CredentialsStore;
import org.apache.hc.client5.http.auth.NTCredentials; import org.apache.hc.client5.http.auth.NTCredentials;
import org.apache.hc.client5.http.auth.UsernamePasswordCredentials; import org.apache.hc.client5.http.auth.UsernamePasswordCredentials;
import org.apache.hc.client5.http.config.ConnectionConfig;
import org.apache.hc.client5.http.cookie.CookieStore; import org.apache.hc.client5.http.cookie.CookieStore;
import org.apache.hc.client5.http.impl.auth.BasicAuthCache; import org.apache.hc.client5.http.impl.auth.BasicAuthCache;
import org.apache.hc.client5.http.impl.auth.BasicCredentialsProvider; import org.apache.hc.client5.http.impl.auth.BasicCredentialsProvider;
@ -64,7 +65,9 @@ public class Executor {
.useSystemProperties() .useSystemProperties()
.setMaxConnPerRoute(100) .setMaxConnPerRoute(100)
.setMaxConnTotal(200) .setMaxConnTotal(200)
.setValidateAfterInactivity(TimeValue.ofSeconds(10)) .setDefaultConnectionConfig(ConnectionConfig.custom()
.setValidateAfterInactivity(TimeValue.ofSeconds(10))
.build())
.build()) .build())
.useSystemProperties() .useSystemProperties()
.evictExpiredConnections() .evictExpiredConnections()