Class RetryPolicy

    • Constructor Detail

      • RetryPolicy

        public RetryPolicy​(String retryAfterHeader,
                           ChronoUnit retryAfterTimeUnit)
        Creates RetryPolicy using ExponentialBackoff() as the RetryStrategy and uses retryAfterHeader to look up the wait period in the returned HttpResponse to calculate the retry delay when a recoverable HTTP error is returned.
        Parameters:
        retryAfterHeader - The HTTP header, such as Retry-After or x-ms-retry-after-ms, to lookup for the retry delay. If the value is null, RetryStrategy.calculateRetryDelay(int) will compute the delay and ignore the delay provided in response header.
        retryAfterTimeUnit - The time unit to use when applying the retry delay. Null is valid if, and only if, retryAfterHeader is null.
        Throws:
        NullPointerException - When retryAfterTimeUnit is null and retryAfterHeader is not null.
      • RetryPolicy

        public RetryPolicy​(RetryStrategy retryStrategy,
                           String retryAfterHeader,
                           ChronoUnit retryAfterTimeUnit)
        Creates RetryPolicy with the provided RetryStrategy and default ExponentialBackoff as RetryStrategy. It will use provided retryAfterHeader in HttpResponse headers for calculating retry delay.
        Parameters:
        retryStrategy - The RetryStrategy used for retries.
        retryAfterHeader - The HTTP header, such as 'Retry-After' or 'x-ms-retry-after-ms', to lookup for the retry delay. If the value is null, RetryPolicy will use the retry strategy to compute the delay and ignore the delay provided in response header.
        retryAfterTimeUnit - The time unit to use when applying the retry delay. null is valid if, and only if, retryAfterHeader is null.
        Throws:
        NullPointerException - If retryStrategy is null or when retryAfterTimeUnit is null and retryAfterHeader is not null.