diff --git a/build.gradle b/build.gradle index f72495fdb..3ab153762 100644 --- a/build.gradle +++ b/build.gradle @@ -9,7 +9,7 @@ plugins { } group 'com.firebolt' -version = '2.2.0' +version = '2.2.1-SNAPSHOT' repositories { mavenCentral() diff --git a/src/main/java/com/firebolt/jdbc/client/FireboltClient.java b/src/main/java/com/firebolt/jdbc/client/FireboltClient.java index e42e90a7b..4fce23a8b 100644 --- a/src/main/java/com/firebolt/jdbc/client/FireboltClient.java +++ b/src/main/java/com/firebolt/jdbc/client/FireboltClient.java @@ -165,7 +165,9 @@ private String getInternalErrorWithHeadersText(CloseableHttpResponse response) { } private RequestConfig createRequestConfig(int connectionTimeoutMillis, int networkTimoutMillis) { - return RequestConfig.custom().setConnectTimeout(Timeout.of(connectionTimeoutMillis, TimeUnit.MILLISECONDS)) + return RequestConfig.custom() + .setConnectTimeout(Timeout.of(connectionTimeoutMillis, TimeUnit.MILLISECONDS)) + .setConnectionRequestTimeout(Timeout.of(connectionTimeoutMillis, TimeUnit.MILLISECONDS)) .setCookieSpec(StandardCookieSpec.RELAXED) .setResponseTimeout(Timeout.ofMilliseconds(networkTimoutMillis)).build(); } diff --git a/src/main/java/com/firebolt/jdbc/client/config/HttpClientCreator.java b/src/main/java/com/firebolt/jdbc/client/config/HttpClientCreator.java index 6910f86cb..cc3a3ff78 100644 --- a/src/main/java/com/firebolt/jdbc/client/config/HttpClientCreator.java +++ b/src/main/java/com/firebolt/jdbc/client/config/HttpClientCreator.java @@ -10,14 +10,11 @@ import java.security.cert.Certificate; import java.security.cert.CertificateException; import java.security.cert.CertificateFactory; -import java.util.concurrent.TimeUnit; import javax.net.ssl.*; import org.apache.commons.lang3.StringUtils; import org.apache.hc.client5.http.HttpRequestRetryStrategy; -import org.apache.hc.client5.http.config.RequestConfig; -import org.apache.hc.client5.http.cookie.StandardCookieSpec; import org.apache.hc.client5.http.impl.DefaultHttpRequestRetryStrategy; import org.apache.hc.client5.http.impl.classic.CloseableHttpClient; import org.apache.hc.client5.http.impl.classic.HttpClientBuilder; @@ -32,7 +29,6 @@ import org.apache.hc.core5.http.io.HttpConnectionFactory; import org.apache.hc.core5.http.io.SocketConfig; import org.apache.hc.core5.util.TimeValue; -import org.apache.hc.core5.util.Timeout; import com.firebolt.jdbc.client.ssl.InsecureTrustManager; import com.firebolt.jdbc.connection.settings.FireboltProperties; @@ -54,7 +50,6 @@ public static CloseableHttpClient createClient(FireboltProperties properties) th return HttpClientBuilder.create().setConnectionManager(getConnectionManager(properties)) .setConnectionManagerShared(true).disableDefaultUserAgent() - .setDefaultRequestConfig(getDefaultRequestConfig(properties)) .setConnectionReuseStrategy(new DefaultConnectionReuseStrategy()) .setRetryStrategy(createRetryStrategy(properties)).disableContentCompression().build(); } @@ -63,12 +58,6 @@ private static HttpRequestRetryStrategy createRetryStrategy(FireboltProperties p return new DefaultHttpRequestRetryStrategy(properties.getMaxRetries(), TimeValue.ofMilliseconds(500)); } - private static RequestConfig getDefaultRequestConfig(FireboltProperties fireboltProperties) { - return RequestConfig.custom() - .setConnectTimeout(Timeout.of(fireboltProperties.getConnectionTimeoutMillis(), TimeUnit.MILLISECONDS)) - .setCookieSpec(StandardCookieSpec.RELAXED).build(); - } - private static PoolingHttpClientConnectionManager getConnectionManager(FireboltProperties fireboltProperties) throws CertificateException, NoSuchAlgorithmException, KeyStoreException, IOException, KeyManagementException { @@ -88,10 +77,8 @@ private static PoolingHttpClientConnectionManager getConnectionManager(FireboltP .validateAfterInactivity( TimeValue.ofMilliseconds(fireboltProperties.getValidateAfterInactivityMillis())) .maxConnTotal(fireboltProperties.getMaxConnectionsTotal()) + .defaultSocketConfig(SocketConfig.custom().setSoKeepAlive(true).build()) .timeToLive(TimeValue.ofMilliseconds(fireboltProperties.getTimeToLiveMillis())) - .defaultSocketConfig(SocketConfig.custom().setSoKeepAlive(true).setSoReuseAddress(true) - .setTcpNoDelay(true).setSoLinger(TimeValue.ofMilliseconds(Integer.MAX_VALUE)) - .setSoTimeout(Timeout.ofMilliseconds(fireboltProperties.getSocketTimeoutMillis())).build()) .fireboltProperties(fireboltProperties).build().create(); }