forked from aws/aws-sdk-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExecutionContext.java
More file actions
136 lines (117 loc) · 4.32 KB
/
ExecutionContext.java
File metadata and controls
136 lines (117 loc) · 4.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
/*
* Copyright 2011-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package com.amazonaws.http;
import java.util.List;
import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.auth.Signer;
import com.amazonaws.handlers.RequestHandler;
import com.amazonaws.internal.CustomBackoffStrategy;
import com.amazonaws.util.AWSRequestMetrics;
public class ExecutionContext {
private List<RequestHandler> requestHandlers;
private String contextUserAgent;
private AWSRequestMetrics awsRequestMetrics = new AWSRequestMetrics();
private CustomBackoffStrategy backoffStrategy;
/** Optional signer to enable the runtime layer to handle signing requests (and resigning on retries). */
private Signer signer;
/** Optional credentials to enable the runtime layer to handle signing requests (and resigning on retries). */
private AWSCredentials credentials;
public String getContextUserAgent() {
return contextUserAgent;
}
public void setContextUserAgent(String contextUserAgent) {
this.contextUserAgent = contextUserAgent;
}
public ExecutionContext() {}
public ExecutionContext(List<RequestHandler> requestHandlers) {
this.requestHandlers = requestHandlers;
}
/**
* Returns a list of request handlers that should be run for a given
* request's execution.
*
* @return The list of request handlers to run for the current request.
*/
public List<RequestHandler> getRequestHandlers() {
return requestHandlers;
}
public AWSRequestMetrics getAwsRequestMetrics() {
return awsRequestMetrics;
}
public void setAwsRequestMetrics(AWSRequestMetrics awsRequestMetrics) {
this.awsRequestMetrics = awsRequestMetrics;
}
/**
* Returns the optional signer used to sign the associated request.
*
* @return The optional signer used to sign the associated request.
*/
public Signer getSigner() {
return signer;
}
/**
* Sets the optional signer used to sign the associated request. If no
* signer is specified as part of a request's ExecutionContext, then the
* runtime layer will not attempt to sign (or resign on retries) requests.
*
* @param signer
* The optional signer used to sign the associated request.
*/
public void setSigner(Signer signer) {
this.signer = signer;
}
/**
* Returns the optional credentials used to sign the associated request.
*
* @return The optional credentials used to sign the associated request.
*/
public AWSCredentials getCredentials() {
return credentials;
}
/**
* Sets the optional credentials used to sign the associated request. If no
* credentials are specified as part of a request's ExecutionContext, then
* the runtime layer will not attempt to sign (or resign on retries)
* requests.
*
* @param credentials
* The optional credentials used to sign the associated request.
*/
public void setCredentials(AWSCredentials credentials) {
this.credentials = credentials;
}
/**
* Returns the optional custom backoff strategy for controlling how long
* between retries on error responses. If no custom backoff strategy is
* specified, a default exponential backoff strategy is used.
*
* @return the optional custom backoff strategy for the associated request.
*/
public CustomBackoffStrategy getCustomBackoffStrategy() {
return backoffStrategy;
}
/**
* Sets the optional custom backoff strategy for controlling how long
* between retries on error responses. If no custom backoff strategy is
* specified, a default exponential backoff strategy is used.
*
* @param backoffStrategy
* The optional custom backoff strategy for the associated
* request.
*/
public void setCustomBackoffStrategy(CustomBackoffStrategy backoffStrategy) {
this.backoffStrategy = backoffStrategy;
}
}