|
24 | 24 | import org.slf4j.LoggerFactory;
|
25 | 25 | import software.amazon.awssdk.annotations.SdkInternalApi;
|
26 | 26 | import software.amazon.awssdk.core.SdkStandardLogger;
|
| 27 | +import software.amazon.awssdk.core.async.AsyncRequestBody; |
27 | 28 | import software.amazon.awssdk.core.client.config.SdkClientOption;
|
28 | 29 | import software.amazon.awssdk.core.exception.NonRetryableException;
|
29 | 30 | import software.amazon.awssdk.core.exception.SdkException;
|
@@ -81,12 +82,14 @@ private class RetryExecutor {
|
81 | 82 | private final SdkHttpFullRequest request;
|
82 | 83 | private final RequestExecutionContext context;
|
83 | 84 | private final RetryHandler retryHandler;
|
| 85 | + private final AsyncRequestBody originalRequestBody; |
84 | 86 |
|
85 | 87 | private int requestCount = 0;
|
86 | 88 |
|
87 | 89 | private RetryExecutor(SdkHttpFullRequest request, RequestExecutionContext context) {
|
88 | 90 | this.request = request;
|
89 | 91 | this.context = context;
|
| 92 | + this.originalRequestBody = context.requestProvider(); |
90 | 93 | this.retryHandler = new RetryHandler(retryPolicy, retryCapacity);
|
91 | 94 | }
|
92 | 95 |
|
@@ -189,6 +192,8 @@ private CompletableFuture<Response<OutputT>> doExecute() throws Exception {
|
189 | 192 | SdkStandardLogger.REQUEST_LOGGER.debug(() -> (retryHandler.isRetry() ? "Retrying " : "Sending ") +
|
190 | 193 | "Request: " + request);
|
191 | 194 |
|
| 195 | + // Before each attempt, Modify the context to use original request body provider |
| 196 | + context.requestProvider(originalRequestBody); |
192 | 197 | return requestPipeline.execute(retryHandler.addRetryInfoHeader(request, requestCount), context);
|
193 | 198 | }
|
194 | 199 | }
|
|
0 commit comments