|
15 | 15 | import software.amazon.smithy.java.auth.api.identity.IdentityResult; |
16 | 16 | import software.amazon.smithy.java.client.core.auth.scheme.AuthScheme; |
17 | 17 | import software.amazon.smithy.java.client.core.auth.scheme.AuthSchemeOption; |
| 18 | +import software.amazon.smithy.java.client.core.auth.scheme.AuthSchemeResolver; |
18 | 19 | import software.amazon.smithy.java.client.core.auth.scheme.AuthSchemeResolverParams; |
19 | 20 | import software.amazon.smithy.java.client.core.interceptors.ClientInterceptor; |
20 | 21 | import software.amazon.smithy.java.client.core.interceptors.InputHook; |
@@ -136,20 +137,15 @@ private <I extends SerializableStruct, O extends SerializableStruct> O acquireRe |
136 | 137 | ClientCall<I, O> call, |
137 | 138 | RequestHook<I, O, RequestT> requestHook |
138 | 139 | ) { |
139 | | - try { |
140 | | - // 8. RetryStrategy: Invoke AcquireRetryToken. |
141 | | - // Can potentially short-circuit the request. |
142 | | - var result = call.retryStrategy.acquireInitialToken(new AcquireInitialTokenRequest(call.retryScope)); |
143 | | - call.retryToken = result.token(); |
144 | | - // Delay if the initial request is pre-emptively throttled. |
145 | | - if (result.delay().toMillis() > 0) { |
146 | | - sleep(result.delay()); |
147 | | - } |
148 | | - return doSendOrRetry(call, requestHook); |
149 | | - } catch (TokenAcquisitionFailedException e) { |
150 | | - // Don't send the request if the circuit breaker prevents it. |
151 | | - throw e; |
| 140 | + // 8. RetryStrategy: Invoke AcquireRetryToken. |
| 141 | + // Can potentially short-circuit the request. |
| 142 | + var result = call.retryStrategy.acquireInitialToken(new AcquireInitialTokenRequest(call.retryScope)); |
| 143 | + call.setRetryToken(result.token()); |
| 144 | + // Delay if the initial request is pre-emptively throttled. |
| 145 | + if (result.delay().toMillis() > 0) { |
| 146 | + sleep(result.delay()); |
152 | 147 | } |
| 148 | + return doSendOrRetry(call, requestHook); |
153 | 149 | } |
154 | 150 |
|
155 | 151 | private <I extends SerializableStruct, O extends SerializableStruct> O doSendOrRetry( |
@@ -459,7 +455,7 @@ private <I extends SerializableStruct, O extends SerializableStruct> O deseriali |
459 | 455 |
|
460 | 456 | // Clear out the retry token. |
461 | 457 | var token = call.retryToken; |
462 | | - call.retryToken = null; |
| 458 | + call.setRetryToken(null); |
463 | 459 |
|
464 | 460 | // 9.c.i If successful: RetryStrategy: Invoke RecordSuccess. |
465 | 461 | if (error == null) { |
@@ -509,7 +505,7 @@ private <I extends SerializableStruct, O extends SerializableStruct> O retry( |
509 | 505 | Duration after |
510 | 506 | ) { |
511 | 507 | // Associate the retry token with the call. |
512 | | - call.retryToken = retryToken; |
| 508 | + call.setRetryToken(retryToken); |
513 | 509 | // Adjust the current retry count on the context (e.g., protocols can use this to add retry headers). |
514 | 510 | call.context.put(CallContext.RETRY_ATTEMPT, ++call.attemptCount); |
515 | 511 |
|
|
0 commit comments