Package com.amazonaws.http
Class ExecutionContext
- java.lang.Object
-
- com.amazonaws.http.ExecutionContext
-
public class ExecutionContext extends Object
a single request lifecycle.
-
-
Constructor Summary
Constructors Constructor Description ExecutionContext()
For testing purposes.ExecutionContext(boolean isMetricEnabled)
For testing purposes.ExecutionContext(List<RequestHandler2> requestHandler2s, boolean isMetricEnabled, AmazonWebServiceClient awsClient)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.amazonaws.retry.internal.AuthErrorRetryStrategy
getAuthErrorRetryStrategy()
Returns the retry strategy for auth errors.protected AmazonWebServiceClient
getAwsClient()
AWSRequestMetrics
getAwsRequestMetrics()
ClientExecutionAbortTrackerTask
getClientExecutionTrackerTask()
AWSCredentialsProvider
getCredentialsProvider()
Returns the credentials provider used for fetching the credentials.List<RequestHandler2>
getRequestHandler2s()
Signer
getSignerByURI(URI uri)
Returns the signer for the given uri.void
markRetryCapacityConsumed()
Marks that a retry during this request lifecycle has consumed retry capacity.boolean
retryCapacityConsumed()
Returns whether retry capacity was consumed during this request lifecycle.void
setAuthErrorRetryStrategy(com.amazonaws.retry.internal.AuthErrorRetryStrategy authErrorRetryStrategy)
Sets the optional auth error retry strategy for this request execution.void
setClientExecutionTrackerTask(ClientExecutionAbortTrackerTask clientExecutionTrackerTask)
void
setCredentialsProvider(AWSCredentialsProvider credentialsProvider)
Sets the credentials provider used for fetching the credentials.void
setSigner(Signer signer)
There is in general no need to set the signer in the execution context, since the signer for each request may differ depending on the URI of the request.
-
-
-
Constructor Detail
-
ExecutionContext
public ExecutionContext(boolean isMetricEnabled)
For testing purposes.
-
ExecutionContext
public ExecutionContext()
For testing purposes.
-
ExecutionContext
public ExecutionContext(List<RequestHandler2> requestHandler2s, boolean isMetricEnabled, AmazonWebServiceClient awsClient)
-
-
Method Detail
-
getRequestHandler2s
public List<RequestHandler2> getRequestHandler2s()
-
getAwsRequestMetrics
public AWSRequestMetrics getAwsRequestMetrics()
-
getAwsClient
protected AmazonWebServiceClient getAwsClient()
-
setSigner
public void setSigner(Signer signer)
There is in general no need to set the signer in the execution context, since the signer for each request may differ depending on the URI of the request. The exception is S3 where the signer is currently determined only when the S3 client is constructed. Hence the need for this method. We may consider supporting a per request level signer determination for S3 later on.
-
retryCapacityConsumed
public boolean retryCapacityConsumed()
Returns whether retry capacity was consumed during this request lifecycle. This can be inspected to determine whether capacity should be released if a retry succeeds.- Returns:
- true if retry capacity was consumed
-
markRetryCapacityConsumed
public void markRetryCapacityConsumed()
Marks that a retry during this request lifecycle has consumed retry capacity. This is inspected when determining if capacity should be released if a retry succeeds.
-
getSignerByURI
public Signer getSignerByURI(URI uri)
Returns the signer for the given uri. Note S3 in particular overrides this method.
-
setCredentialsProvider
public void setCredentialsProvider(AWSCredentialsProvider credentialsProvider)
Sets the credentials provider used for fetching the credentials. The credentials fetched is used for signing the request. If there is no credential provider, then the runtime will not attempt to sign (or resign on retries) requests.- Parameters:
credentialsProvider
- the credentials provider to fetchAWSCredentials
-
getCredentialsProvider
public AWSCredentialsProvider getCredentialsProvider()
Returns the credentials provider used for fetching the credentials. The credentials fetched is used for signing the request. If there is no credential provider, then the runtime will not attempt to sign (or resign on retries) requests.- Returns:
- the credentials provider to fetch
AWSCredentials
-
getAuthErrorRetryStrategy
public com.amazonaws.retry.internal.AuthErrorRetryStrategy getAuthErrorRetryStrategy()
Returns the retry strategy for auth errors. This is currently only used by the S3 client for auto-resolving sigv4-required regions.Note that this will be checked BEFORE the HTTP client consults the user-specified RetryPolicy. i.e. if the configured AuthErrorRetryStrategy says the request should be retried, the retry will be performed internally and the effect is transparent to the user's RetryPolicy.
-
setAuthErrorRetryStrategy
public void setAuthErrorRetryStrategy(com.amazonaws.retry.internal.AuthErrorRetryStrategy authErrorRetryStrategy)
Sets the optional auth error retry strategy for this request execution.- See Also:
getAuthErrorRetryStrategy()
-
getClientExecutionTrackerTask
public ClientExecutionAbortTrackerTask getClientExecutionTrackerTask()
-
setClientExecutionTrackerTask
public void setClientExecutionTrackerTask(ClientExecutionAbortTrackerTask clientExecutionTrackerTask)
-
-