Class RetryableStageHelper

    • Method Detail

      • startingAttempt

        public void startingAttempt()
        Invoke when starting a request attempt, before querying the retry policy.
      • retryPolicyAllowsRetry

        public boolean retryPolicyAllowsRetry()
        Returns true if the retry policy allows this attempt. This will always return true if the current attempt is not a retry (i.e. it's the first request in the execution).
      • retryPolicyDisallowedRetryException

        public SdkException retryPolicyDisallowedRetryException()
        Return the exception that should be thrown, because the retry policy did not allow the request to be retried.
      • getBackoffDelay

        public Duration getBackoffDelay()
        Get the amount of time that the request should be delayed before being sent. This may be Duration.ZERO, such as for the first request in the request series.
      • logBackingOff

        public 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.
      • requestToSend

        public SdkHttpFullRequest requestToSend()
        Retrieve the request to send to the service, including any detailed retry information headers.
      • logSendingRequest

        public void logSendingRequest()
        Log a message to the user at the debug level to indicate that we are sending the request to the service.
      • adjustClockIfClockSkew

        public 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. This will allow a retried request to be signed with what is likely to be a more accurate time.
      • attemptSucceeded

        public void attemptSucceeded()
        Notify the retry policy that the request attempt succeeded.
      • getAttemptNumber

        public int getAttemptNumber()
        Retrieve the current attempt number, updated whenever startingAttempt() is invoked.
      • setLastException

        public void setLastException​(Throwable lastException)
        Update the getLastException() value for this helper. This will be used to determine whether the request should be retried.
      • setLastResponse

        public void setLastResponse​(SdkHttpResponse lastResponse)
        Set the last HTTP response returned by the service. This will be used to determine whether the request should be retried.
      • isFastFailRateLimiting

        public boolean isFastFailRateLimiting()
        Whether rate limiting should fast fail.
      • isLastExceptionThrottlingException

        public boolean isLastExceptionThrottlingException()
      • getSendToken

        public void getSendToken()
        Acquire a send token from the rate limiter. Returns immediately if rate limiting is not enabled.
      • updateClientSendingRateForErrorResponse

        public void updateClientSendingRateForErrorResponse()
        Conditionally updates the sending rate of the rate limiter when an error response is received. This operation is a noop if rate limiting is not enabled.
      • updateClientSendingRateForSuccessResponse

        public void updateClientSendingRateForSuccessResponse()
        Conditionally updates the sending rate of the rate limiter when an error response is received. This operation is a noop if rate limiting is not enabled.