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

    Modifier and Type
    Method
    Description
    default org.apache.hc.core5.util.TimeValue
    getRetryInterval(org.apache.hc.core5.http.HttpRequest request, IOException exception, int execCount, org.apache.hc.core5.http.protocol.HttpContext context)
    Determines the retry interval between subsequent retries.
    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 occurred 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 Details

    • 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 occurred 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

      default org.apache.hc.core5.util.TimeValue getRetryInterval(org.apache.hc.core5.http.HttpRequest request, IOException exception, int execCount, org.apache.hc.core5.http.protocol.HttpContext context)
      Determines the retry interval between subsequent retries.
      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:
      the retry interval between subsequent retries
    • 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