org.apache.hc.client5.http

## Interface HttpRequestRetryStrategy

- All Known Implementing Classes:
    DefaultHttpRequestRetryStrategy

      @Contract(threading=STATELESS)
      public interface HttpRequestRetryStrategy

  Strategy interface that allows API users to plug in their own logic to control whether or not a retry should automatically be done, how many times it should be done and so on.
  Since:
    5.0

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `org.apache.hc.core5.util.TimeValue` | `getRetryInterval(org.apache.hc.core5.http.HttpResponse response, int execCount, org.apache.hc.core5.http.protocol.HttpContext context)` Determines the retry interval between subsequent retries.
    `boolean` | `retryRequest(org.apache.hc.core5.http.HttpRequest request, IOException exception, int execCount, org.apache.hc.core5.http.protocol.HttpContext context)` Determines if a method should be retried after an I/O exception occured during execution.
    `boolean` | `retryRequest(org.apache.hc.core5.http.HttpResponse response, int execCount, org.apache.hc.core5.http.protocol.HttpContext context)` Determines if a method should be retried given the response from the target server.

- - ### Method Detail

    - #### retryRequest

          boolean retryRequest(org.apache.hc.core5.http.HttpRequest request,
                             IOException exception,
                             int execCount,
                             org.apache.hc.core5.http.protocol.HttpContext context)

      Determines if a method should be retried after an I/O exception occured during execution.
      Parameters:
        `request` - the request failed due to an I/O exception
        `exception` - the exception that occurred
        `execCount` - the number of times this method has been unsuccessfully executed
        `context` - the context for the request execution
      Returns:
        `true` if the request should be retried, `false` otherwise

    - #### retryRequest

          boolean retryRequest(org.apache.hc.core5.http.HttpResponse response,
                             int execCount,
                             org.apache.hc.core5.http.protocol.HttpContext context)

      Determines if a method should be retried given the response from the target server.
      Parameters:
        `response` - the response from the target server
        `execCount` - the number of times this method has been unsuccessfully executed
        `context` - the context for the request execution
      Returns:
        `true` if the request should be retried, `false` otherwise

    - #### getRetryInterval

          org.apache.hc.core5.util.TimeValue getRetryInterval(org.apache.hc.core5.http.HttpResponse response,
                                                            int execCount,
                                                            org.apache.hc.core5.http.protocol.HttpContext context)

      Determines the retry interval between subsequent retries.
      Parameters:
        `response` - the response from the target server
        `execCount` - the number of times this method has been unsuccessfully executed
        `context` - the context for the request execution
      Returns:
        the retry interval between subsequent retries

Copyright © 1999–2021 The Apache Software Foundation. All rights reserved.