public final class RetryableStageHelper extends Object
RetryableStage and AsyncRetryableStage when querying and interacting with a
RetryStrategy.| Modifier and Type | Field and Description |
|---|---|
static ExecutionAttribute<Duration> |
LAST_BACKOFF_DELAY_DURATION |
static String |
SDK_RETRY_INFO_HEADER |
| Constructor and Description |
|---|
RetryableStageHelper(SdkHttpFullRequest request,
RequestExecutionContext context,
HttpClientDependencies dependencies) |
| Modifier and Type | Method and Description |
|---|---|
Duration |
acquireInitialToken()
Invoke when starting the first attempt.
|
void |
adjustClockIfClockSkew(Response<?> response)
Adjust the client-side clock skew if the provided response indicates that there is a large skew between the client and
service.
|
int |
getAttemptNumber()
Retrieve the current attempt number, updated whenever
startingAttempt() is invoked. |
SdkException |
getLastException()
Retrieve the last call failure exception encountered by this execution, updated whenever
setLastException(java.lang.Throwable) is
invoked. |
void |
logBackingOff(Duration backoffDelay)
Log a message to the user at the debug level to indicate how long we will wait before retrying the request.
|
void |
logSendingRequest()
Log a message to the user at the debug level to indicate that we are sending the request to the service.
|
void |
recordAttemptSucceeded()
Notify the retry strategy that the request attempt succeeded.
|
SdkHttpFullRequest |
requestToSend()
Retrieve the request to send to the service, including any detailed retry information headers.
|
SdkException |
retryPolicyDisallowedRetryException()
Return the exception that should be thrown, because the retry strategy did not allow the request to be retried.
|
void |
setLastException(Throwable lastException)
Update the
getLastException() value for this helper. |
void |
setLastResponse(SdkHttpResponse lastResponse)
Set the last HTTP response returned by the service.
|
void |
startingAttempt()
Invoke when starting a request attempt, before querying the retry policy.
|
Optional<Duration> |
tryRefreshToken(Duration suggestedDelay)
Invoked after a failed attempt and before retrying.
|
public static final String SDK_RETRY_INFO_HEADER
public static final ExecutionAttribute<Duration> LAST_BACKOFF_DELAY_DURATION
public RetryableStageHelper(SdkHttpFullRequest request, RequestExecutionContext context, HttpClientDependencies dependencies)
public void startingAttempt()
public Duration acquireInitialToken()
Duration.ZERO if the calling code does not have to wait. As of today the only strategy that might return a non-zero
value is AdaptiveRetryStrategy.public void recordAttemptSucceeded()
public Optional<Duration> tryRefreshToken(Duration suggestedDelay)
suggestedDelay - A suggested delay, presumably coming from the server response. The response when present will be at
least this amount.public SdkException retryPolicyDisallowedRetryException()
public void logBackingOff(Duration backoffDelay)
public SdkHttpFullRequest requestToSend()
public void logSendingRequest()
public void adjustClockIfClockSkew(Response<?> response)
public SdkException getLastException()
setLastException(java.lang.Throwable) is
invoked.public void setLastException(Throwable lastException)
getLastException() value for this helper. This will be used to determine whether the request should be
retried.public void setLastResponse(SdkHttpResponse lastResponse)
public int getAttemptNumber()
startingAttempt() is invoked.Copyright © 2026. All rights reserved.