Package net.snowflake.client.jdbc
Class RestRequest
- java.lang.Object
-
- net.snowflake.client.jdbc.RestRequest
-
public class RestRequest extends Object
This is an abstraction on top of http client.Currently it only has one method for retrying http request execution so that the same logic doesn't have to be replicated at difference places where retry is needed.
-
-
Constructor Summary
Constructors Constructor Description RestRequest()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static org.apache.http.client.methods.CloseableHttpResponse
execute(org.apache.http.impl.client.CloseableHttpClient httpClient, org.apache.http.client.methods.HttpRequestBase httpRequest, long retryTimeout, long authTimeout, int socketTimeout, int maxRetries, int injectSocketTimeout, AtomicBoolean canceling, boolean withoutCookies, boolean includeRetryParameters, boolean includeRequestGuid, boolean retryHTTP403, boolean noRetry, ExecTimeTelemetryData execTimeData)
Deprecated.static org.apache.http.client.methods.CloseableHttpResponse
execute(org.apache.http.impl.client.CloseableHttpClient httpClient, org.apache.http.client.methods.HttpRequestBase httpRequest, long retryTimeout, long authTimeout, int socketTimeout, int maxRetries, int injectSocketTimeout, AtomicBoolean canceling, boolean withoutCookies, boolean includeRetryParameters, boolean includeRequestGuid, boolean retryHTTP403, boolean noRetry, ExecTimeTelemetryData execTimeData, SFBaseSession sfSession)
Execute an HTTP request with retry logic.static org.apache.http.client.methods.CloseableHttpResponse
execute(org.apache.http.impl.client.CloseableHttpClient httpClient, org.apache.http.client.methods.HttpRequestBase httpRequest, long retryTimeout, long authTimeout, int socketTimeout, int maxRetries, int injectSocketTimeout, AtomicBoolean canceling, boolean withoutCookies, boolean includeRetryParameters, boolean includeRequestGuid, boolean retryHTTP403, boolean noRetry, ExecTimeTelemetryData execTimeData, RetryContextManager retryManager)
Deprecated.static org.apache.http.client.methods.CloseableHttpResponse
execute(org.apache.http.impl.client.CloseableHttpClient httpClient, org.apache.http.client.methods.HttpRequestBase httpRequest, long retryTimeout, long authTimeout, int socketTimeout, int maxRetries, int injectSocketTimeout, AtomicBoolean canceling, boolean withoutCookies, boolean includeRetryParameters, boolean includeRequestGuid, boolean retryHTTP403, boolean noRetry, ExecTimeTelemetryData execTimeData, RetryContextManager retryManager, SFBaseSession sfSession, HttpClientSettingsKey key, List<HttpHeadersCustomizer> httpHeaderCustomizer, boolean isHttpClientWithoutDecompression)
Execute an HTTP request with retry logic.static org.apache.http.client.methods.CloseableHttpResponse
execute(org.apache.http.impl.client.CloseableHttpClient httpClient, org.apache.http.client.methods.HttpRequestBase httpRequest, long retryTimeout, long authTimeout, int socketTimeout, int maxRetries, int injectSocketTimeout, AtomicBoolean canceling, boolean withoutCookies, boolean includeRetryParameters, boolean includeRequestGuid, boolean retryHTTP403, ExecTimeTelemetryData execTimeTelemetryData)
Deprecated.static org.apache.http.client.methods.CloseableHttpResponse
execute(org.apache.http.impl.client.CloseableHttpClient httpClient, org.apache.http.client.methods.HttpRequestBase httpRequest, long retryTimeout, long authTimeout, int socketTimeout, int maxRetries, int injectSocketTimeout, AtomicBoolean canceling, boolean withoutCookies, boolean includeRetryParameters, boolean includeRequestGuid, boolean retryHTTP403, ExecTimeTelemetryData execTimeTelemetryData, SFBaseSession sfSession)
Execute an HTTP request with retry logic.static org.apache.http.client.methods.CloseableHttpResponse
execute(org.apache.http.impl.client.CloseableHttpClient httpClient, org.apache.http.client.methods.HttpRequestBase httpRequest, long retryTimeout, long authTimeout, int socketTimeout, int maxRetries, int injectSocketTimeout, AtomicBoolean canceling, boolean withoutCookies, boolean includeRetryParameters, boolean includeRequestGuid, boolean retryHTTP403, ExecTimeTelemetryData execTimeData, RetryContextManager retryContextManager)
Deprecated.static org.apache.http.client.methods.CloseableHttpResponse
execute(org.apache.http.impl.client.CloseableHttpClient httpClient, org.apache.http.client.methods.HttpRequestBase httpRequest, long retryTimeout, long authTimeout, int socketTimeout, int maxRetries, int injectSocketTimeout, AtomicBoolean canceling, boolean withoutCookies, boolean includeRetryParameters, boolean includeRequestGuid, boolean retryHTTP403, ExecTimeTelemetryData execTimeData, RetryContextManager retryContextManager, SFBaseSession sfSession)
Execute an HTTP request with retry logic.static HttpResponseContextDto
executeWithRetries(org.apache.http.impl.client.CloseableHttpClient httpClient, org.apache.http.client.methods.HttpRequestBase httpRequest, long retryTimeout, long authTimeout, int socketTimeout, int maxRetries, int injectSocketTimeout, AtomicBoolean canceling, boolean withoutCookies, boolean includeRetryParameters, boolean includeRequestGuid, boolean retryHTTP403, boolean noRetry, boolean unpackResponse, ExecTimeTelemetryData execTimeTelemetryData, SFBaseSession sfSession, HttpClientSettingsKey key, List<HttpHeadersCustomizer> httpHeaderCustomizer, boolean isHttpClientWithoutDecompression)
Execute an HTTP request with retry logic.static HttpResponseContextDto
executeWithRetries(org.apache.http.impl.client.CloseableHttpClient httpClient, org.apache.http.client.methods.HttpRequestBase httpRequest, long retryTimeout, long authTimeout, int socketTimeout, int maxRetries, int injectSocketTimeout, AtomicBoolean canceling, boolean withoutCookies, boolean includeRetryParameters, boolean includeRequestGuid, boolean retryHTTP403, boolean unpackResponse, ExecTimeTelemetryData execTimeTelemetryData, SFBaseSession sfSession, HttpClientSettingsKey key, List<HttpHeadersCustomizer> httpHeaderCustomizer, boolean isHttpClientWithoutDecompression)
Execute an HTTP request with retry logic.static HttpResponseContextDto
executeWithRetries(org.apache.http.impl.client.CloseableHttpClient httpClient, org.apache.http.client.methods.HttpRequestBase httpRequest, HttpExecutingContext httpExecutingContext, ExecTimeTelemetryData execTimeData, RetryContextManager retryManager, HttpClientSettingsKey key, List<HttpHeadersCustomizer> httpHeaderCustomizer, boolean isHttpClientWithoutDecompression)
Execute an HTTP request with retry logic.
-
-
-
Method Detail
-
execute
@Deprecated public static org.apache.http.client.methods.CloseableHttpResponse execute(org.apache.http.impl.client.CloseableHttpClient httpClient, org.apache.http.client.methods.HttpRequestBase httpRequest, long retryTimeout, long authTimeout, int socketTimeout, int maxRetries, int injectSocketTimeout, AtomicBoolean canceling, boolean withoutCookies, boolean includeRetryParameters, boolean includeRequestGuid, boolean retryHTTP403, ExecTimeTelemetryData execTimeTelemetryData) throws SnowflakeSQLException
Deprecated.Execute an HTTP request with retry logic.- Parameters:
httpClient
- client object used to communicate with other machinehttpRequest
- request object contains all the request informationretryTimeout
- : retry timeout (in seconds)authTimeout
- : authenticator specific timeout (in seconds)socketTimeout
- : curl timeout (in ms)maxRetries
- : max retry count for the requestinjectSocketTimeout
- : simulate socket timeoutcanceling
- canceling flagwithoutCookies
- whether the cookie spec should be set to IGNORE or notincludeRetryParameters
- whether to include retry parameters in retried requests. Only needs to be true for JDBC statement execution (query requests to Snowflake server).includeRequestGuid
- whether to include request_guid parameterretryHTTP403
- whether to retry on HTTP 403 or not should be executed before and/or after the retry- Returns:
- HttpResponse Object get from server
- Throws:
SnowflakeSQLException
- Request timeout Exception or Illegal State Exception i.e. connection is already shutdown etc
-
execute
@SnowflakeJdbcInternalApi public static org.apache.http.client.methods.CloseableHttpResponse execute(org.apache.http.impl.client.CloseableHttpClient httpClient, org.apache.http.client.methods.HttpRequestBase httpRequest, long retryTimeout, long authTimeout, int socketTimeout, int maxRetries, int injectSocketTimeout, AtomicBoolean canceling, boolean withoutCookies, boolean includeRetryParameters, boolean includeRequestGuid, boolean retryHTTP403, ExecTimeTelemetryData execTimeTelemetryData, SFBaseSession sfSession) throws SnowflakeSQLException
Execute an HTTP request with retry logic.- Parameters:
httpClient
- client object used to communicate with other machinehttpRequest
- request object contains all the request informationretryTimeout
- : retry timeout (in seconds)authTimeout
- : authenticator specific timeout (in seconds)socketTimeout
- : curl timeout (in ms)maxRetries
- : max retry count for the requestinjectSocketTimeout
- : simulate socket timeoutcanceling
- canceling flagwithoutCookies
- whether the cookie spec should be set to IGNORE or notincludeRetryParameters
- whether to include retry parameters in retried requests. Only needs to be true for JDBC statement execution (query requests to Snowflake server).includeRequestGuid
- whether to include request_guid parameterretryHTTP403
- whether to retry on HTTP 403 or not should be executed before and/or after the retrysfSession
- the session associated with the request- Returns:
- HttpResponse Object get from server
- Throws:
SnowflakeSQLException
- Request timeout Exception or Illegal State Exception i.e. connection is already shutdown etc
-
execute
@Deprecated public static org.apache.http.client.methods.CloseableHttpResponse execute(org.apache.http.impl.client.CloseableHttpClient httpClient, org.apache.http.client.methods.HttpRequestBase httpRequest, long retryTimeout, long authTimeout, int socketTimeout, int maxRetries, int injectSocketTimeout, AtomicBoolean canceling, boolean withoutCookies, boolean includeRetryParameters, boolean includeRequestGuid, boolean retryHTTP403, boolean noRetry, ExecTimeTelemetryData execTimeData) throws SnowflakeSQLException
Deprecated.Execute an HTTP request with retry logic.- Parameters:
httpClient
- client object used to communicate with other machinehttpRequest
- request object contains all the request informationretryTimeout
- : retry timeout (in seconds)authTimeout
- : authenticator specific timeout (in seconds)socketTimeout
- : curl timeout (in ms)maxRetries
- : max retry count for the requestinjectSocketTimeout
- : simulate socket timeoutcanceling
- canceling flagwithoutCookies
- whether the cookie spec should be set to IGNORE or notincludeRetryParameters
- whether to include retry parameters in retried requests. Only needs to be true for JDBC statement execution (query requests to Snowflake server).includeRequestGuid
- whether to include request_guid parameterretryHTTP403
- whether to retry on HTTP 403 or not should be executed before and/or after the retry- Returns:
- HttpResponse Object get from server
- Throws:
SnowflakeSQLException
- Request timeout Exception or Illegal State Exception i.e. connection is already shutdown etc
-
execute
@SnowflakeJdbcInternalApi public static org.apache.http.client.methods.CloseableHttpResponse execute(org.apache.http.impl.client.CloseableHttpClient httpClient, org.apache.http.client.methods.HttpRequestBase httpRequest, long retryTimeout, long authTimeout, int socketTimeout, int maxRetries, int injectSocketTimeout, AtomicBoolean canceling, boolean withoutCookies, boolean includeRetryParameters, boolean includeRequestGuid, boolean retryHTTP403, boolean noRetry, ExecTimeTelemetryData execTimeData, SFBaseSession sfSession) throws SnowflakeSQLException
Execute an HTTP request with retry logic.- Parameters:
httpClient
- client object used to communicate with other machinehttpRequest
- request object contains all the request informationretryTimeout
- : retry timeout (in seconds)authTimeout
- : authenticator specific timeout (in seconds)socketTimeout
- : curl timeout (in ms)maxRetries
- : max retry count for the requestinjectSocketTimeout
- : simulate socket timeoutcanceling
- canceling flagwithoutCookies
- whether the cookie spec should be set to IGNORE or notincludeRetryParameters
- whether to include retry parameters in retried requests. Only needs to be true for JDBC statement execution (query requests to Snowflake server).includeRequestGuid
- whether to include request_guid parameterretryHTTP403
- whether to retry on HTTP 403 or not should be executed before and/or after the retrysfSession
- the session associated with the request- Returns:
- HttpResponse Object get from server
- Throws:
SnowflakeSQLException
- Request timeout Exception or Illegal State Exception i.e. connection is already shutdown etc
-
execute
@Deprecated public static org.apache.http.client.methods.CloseableHttpResponse execute(org.apache.http.impl.client.CloseableHttpClient httpClient, org.apache.http.client.methods.HttpRequestBase httpRequest, long retryTimeout, long authTimeout, int socketTimeout, int maxRetries, int injectSocketTimeout, AtomicBoolean canceling, boolean withoutCookies, boolean includeRetryParameters, boolean includeRequestGuid, boolean retryHTTP403, ExecTimeTelemetryData execTimeData, RetryContextManager retryContextManager) throws SnowflakeSQLException
Deprecated.Execute an HTTP request with retry logic.- Parameters:
httpClient
- client object used to communicate with other machinehttpRequest
- request object contains all the request informationretryTimeout
- : retry timeout (in seconds)authTimeout
- : authenticator specific timeout (in seconds)socketTimeout
- : curl timeout (in ms)maxRetries
- : max retry count for the requestinjectSocketTimeout
- : simulate socket timeoutcanceling
- canceling flagwithoutCookies
- whether the cookie spec should be set to IGNORE or notincludeRetryParameters
- whether to include retry parameters in retried requests. Only needs to be true for JDBC statement execution (query requests to Snowflake server).includeRequestGuid
- whether to include request_guid parameterretryHTTP403
- whether to retry on HTTP 403 or notexecTimeData
- ExecTimeTelemetryData should be executed before and/or after the retry- Returns:
- HttpResponse Object get from server
- Throws:
SnowflakeSQLException
- Request timeout Exception or Illegal State Exception i.e. connection is already shutdown etc
-
execute
@SnowflakeJdbcInternalApi public static org.apache.http.client.methods.CloseableHttpResponse execute(org.apache.http.impl.client.CloseableHttpClient httpClient, org.apache.http.client.methods.HttpRequestBase httpRequest, long retryTimeout, long authTimeout, int socketTimeout, int maxRetries, int injectSocketTimeout, AtomicBoolean canceling, boolean withoutCookies, boolean includeRetryParameters, boolean includeRequestGuid, boolean retryHTTP403, ExecTimeTelemetryData execTimeData, RetryContextManager retryContextManager, SFBaseSession sfSession) throws SnowflakeSQLException
Execute an HTTP request with retry logic.- Parameters:
httpClient
- client object used to communicate with other machinehttpRequest
- request object contains all the request informationretryTimeout
- : retry timeout (in seconds)authTimeout
- : authenticator specific timeout (in seconds)socketTimeout
- : curl timeout (in ms)maxRetries
- : max retry count for the requestinjectSocketTimeout
- : simulate socket timeoutcanceling
- canceling flagwithoutCookies
- whether the cookie spec should be set to IGNORE or notincludeRetryParameters
- whether to include retry parameters in retried requests. Only needs to be true for JDBC statement execution (query requests to Snowflake server).includeRequestGuid
- whether to include request_guid parameterretryHTTP403
- whether to retry on HTTP 403 or notexecTimeData
- ExecTimeTelemetryData should be executed before and/or after the retrysfSession
- the session associated with the request- Returns:
- HttpResponse Object get from server
- Throws:
SnowflakeSQLException
- Request timeout Exception or Illegal State Exception i.e. connection is already shutdown etc
-
execute
@Deprecated public static org.apache.http.client.methods.CloseableHttpResponse execute(org.apache.http.impl.client.CloseableHttpClient httpClient, org.apache.http.client.methods.HttpRequestBase httpRequest, long retryTimeout, long authTimeout, int socketTimeout, int maxRetries, int injectSocketTimeout, AtomicBoolean canceling, boolean withoutCookies, boolean includeRetryParameters, boolean includeRequestGuid, boolean retryHTTP403, boolean noRetry, ExecTimeTelemetryData execTimeData, RetryContextManager retryManager) throws SnowflakeSQLException
Deprecated.Execute an HTTP request with retry logic.- Parameters:
httpClient
- client object used to communicate with other machinehttpRequest
- request object contains all the request informationretryTimeout
- : retry timeout (in seconds)authTimeout
- : authenticator specific timeout (in seconds)socketTimeout
- : curl timeout (in ms)maxRetries
- : max retry count for the requestinjectSocketTimeout
- : simulate socket timeoutcanceling
- canceling flagwithoutCookies
- whether the cookie spec should be set to IGNORE or notincludeRetryParameters
- whether to include retry parameters in retried requests. Only needs to be true for JDBC statement execution (query requests to Snowflake server).includeRequestGuid
- whether to include request_guid parameterretryHTTP403
- whether to retry on HTTP 403 or notnoRetry
- should we disable retry on non-successful http resp codeexecTimeData
- ExecTimeTelemetryDataretryManager
- RetryContextManager - object allowing to optionally pass custom logic that should be executed before and/or after the retry- Returns:
- HttpResponse Object get from server
- Throws:
SnowflakeSQLException
- Request timeout Exception or Illegal State Exception i.e. connection is already shutdown etc
-
execute
@SnowflakeJdbcInternalApi public static org.apache.http.client.methods.CloseableHttpResponse execute(org.apache.http.impl.client.CloseableHttpClient httpClient, org.apache.http.client.methods.HttpRequestBase httpRequest, long retryTimeout, long authTimeout, int socketTimeout, int maxRetries, int injectSocketTimeout, AtomicBoolean canceling, boolean withoutCookies, boolean includeRetryParameters, boolean includeRequestGuid, boolean retryHTTP403, boolean noRetry, ExecTimeTelemetryData execTimeData, RetryContextManager retryManager, SFBaseSession sfSession, HttpClientSettingsKey key, List<HttpHeadersCustomizer> httpHeaderCustomizer, boolean isHttpClientWithoutDecompression) throws SnowflakeSQLException
Execute an HTTP request with retry logic.- Parameters:
httpClient
- client object used to communicate with other machinehttpRequest
- request object contains all the request informationretryTimeout
- : retry timeout (in seconds)authTimeout
- : authenticator specific timeout (in seconds)socketTimeout
- : curl timeout (in ms)maxRetries
- : max retry count for the requestinjectSocketTimeout
- : simulate socket timeoutcanceling
- canceling flagwithoutCookies
- whether the cookie spec should be set to IGNORE or notincludeRetryParameters
- whether to include retry parameters in retried requests. Only needs to be true for JDBC statement execution (query requests to Snowflake server).includeRequestGuid
- whether to include request_guid parameterretryHTTP403
- whether to retry on HTTP 403 or notnoRetry
- should we disable retry on non-successful http resp codeexecTimeData
- ExecTimeTelemetryDataretryManager
- RetryContextManager - object allowing to optionally pass custom logic that should be executed before and/or after the retrysfSession
- the session associated with the requestkey
- HttpClientSettingsKey objecthttpHeaderCustomizer
- HttpHeadersCustomizer object for customization of HTTP headers for requests sent by the Snowflake JDBC driver.isHttpClientWithoutDecompression
- flag for create client without Decompression- Returns:
- HttpResponse Object get from server
- Throws:
SnowflakeSQLException
- Request timeout Exception or Illegal State Exception i.e. connection is already shutdown etc
-
executeWithRetries
@SnowflakeJdbcInternalApi public static HttpResponseContextDto executeWithRetries(org.apache.http.impl.client.CloseableHttpClient httpClient, org.apache.http.client.methods.HttpRequestBase httpRequest, long retryTimeout, long authTimeout, int socketTimeout, int maxRetries, int injectSocketTimeout, AtomicBoolean canceling, boolean withoutCookies, boolean includeRetryParameters, boolean includeRequestGuid, boolean retryHTTP403, boolean unpackResponse, ExecTimeTelemetryData execTimeTelemetryData, SFBaseSession sfSession, HttpClientSettingsKey key, List<HttpHeadersCustomizer> httpHeaderCustomizer, boolean isHttpClientWithoutDecompression) throws SnowflakeSQLException
Execute an HTTP request with retry logic.- Parameters:
httpClient
- client object used to communicate with other machinehttpRequest
- request object contains all the request informationretryTimeout
- : retry timeout (in seconds)authTimeout
- : authenticator specific timeout (in seconds)socketTimeout
- : curl timeout (in ms)maxRetries
- : max retry count for the requestinjectSocketTimeout
- : simulate socket timeoutcanceling
- canceling flagwithoutCookies
- whether the cookie spec should be set to IGNORE or notincludeRetryParameters
- whether to include retry parameters in retried requests. Only needs to be true for JDBC statement execution (query requests to Snowflake server).includeRequestGuid
- whether to include request_guid parameterretryHTTP403
- whether to retry on HTTP 403 or notsfSession
- the session associated with the request- Returns:
- HttpResponseContextDto Object get from server or exception
- Throws:
SnowflakeSQLException
- Request timeout Exception or Illegal State Exception i.e. connection is already shutdown etc
-
executeWithRetries
@SnowflakeJdbcInternalApi public static HttpResponseContextDto executeWithRetries(org.apache.http.impl.client.CloseableHttpClient httpClient, org.apache.http.client.methods.HttpRequestBase httpRequest, long retryTimeout, long authTimeout, int socketTimeout, int maxRetries, int injectSocketTimeout, AtomicBoolean canceling, boolean withoutCookies, boolean includeRetryParameters, boolean includeRequestGuid, boolean retryHTTP403, boolean noRetry, boolean unpackResponse, ExecTimeTelemetryData execTimeTelemetryData, SFBaseSession sfSession, HttpClientSettingsKey key, List<HttpHeadersCustomizer> httpHeaderCustomizer, boolean isHttpClientWithoutDecompression) throws SnowflakeSQLException
Execute an HTTP request with retry logic.- Parameters:
httpClient
- client object used to communicate with other machinehttpRequest
- request object contains all the request informationretryTimeout
- : retry timeout (in seconds)authTimeout
- : authenticator specific timeout (in seconds)socketTimeout
- : curl timeout (in ms)maxRetries
- : max retry count for the requestinjectSocketTimeout
- : simulate socket timeoutcanceling
- canceling flagwithoutCookies
- whether the cookie spec should be set to IGNORE or notincludeRetryParameters
- whether to include retry parameters in retried requests. Only needs to be true for JDBC statement execution (query requests to Snowflake server).includeRequestGuid
- whether to include request_guid parameterretryHTTP403
- whether to retry on HTTP 403 or notexecTimeTelemetryData
- ExecTimeTelemetryData should be executed before and/or after the retrysfSession
- the session associated with the request- Returns:
- HttpResponseContextDto Object get from server or exception
- Throws:
SnowflakeSQLException
- Request timeout Exception or Illegal State Exception i.e. connection is already shutdown etc
-
executeWithRetries
@SnowflakeJdbcInternalApi public static HttpResponseContextDto executeWithRetries(org.apache.http.impl.client.CloseableHttpClient httpClient, org.apache.http.client.methods.HttpRequestBase httpRequest, HttpExecutingContext httpExecutingContext, ExecTimeTelemetryData execTimeData, RetryContextManager retryManager, HttpClientSettingsKey key, List<HttpHeadersCustomizer> httpHeaderCustomizer, boolean isHttpClientWithoutDecompression) throws SnowflakeSQLException
Execute an HTTP request with retry logic.- Parameters:
httpClient
- client object used to communicate with other machinehttpRequest
- request object contains all the request informationexecTimeData
- ExecTimeTelemetryData should be executed before and/or after the retryretryManager
- RetryManager containing extra actions used during retries- Returns:
- HttpResponseContextDto Object get from server or exception
- Throws:
SnowflakeSQLException
- Request timeout Exception or Illegal State Exception i.e. connection is already shutdown etc
-
-