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.
- Author:
- jhuang
-
-
Constructor Summary
Constructors Constructor Description RestRequest()
-
Method Summary
All Methods Static Methods Concrete 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)
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)
-
-
-
Method Detail
-
execute
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
- Throws:
SnowflakeSQLException
-
execute
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
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 code- Returns:
- HttpResponse Object get from server
- Throws:
SnowflakeSQLException
- Request timeout Exception or Illegal State Exception i.e. connection is already shutdown etc
-
-