org.apache.hc.client5.http.classic

## Interface ConnectionBackoffStrategy

- All Known Implementing Classes:
    DefaultBackoffStrategy, NullBackoffStrategy

      public interface ConnectionBackoffStrategy

  When managing a dynamic number of connections for a given route, this strategy assesses whether a given request execution outcome should result in a backoff signal or not, based on either examining the `Throwable` that resulted or by examining the resulting response (e.g. for its status code).
  Since:
    4.2

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `shouldBackoff(org.apache.hc.core5.http.HttpResponse response)` Determines whether receiving the given `HttpResponse` as a result of request execution should result in a backoff signal.
    `boolean` | `shouldBackoff(Throwable t)` Determines whether seeing the given `Throwable` as a result of request execution should result in a backoff signal.

- - ### Method Detail

    - #### shouldBackoff

          boolean shouldBackoff(Throwable t)

      Determines whether seeing the given `Throwable` as a result of request execution should result in a backoff signal.
      Parameters:
        `t` - the `Throwable` that happened
      Returns:
        `true` if a backoff signal should be given

    - #### shouldBackoff

          boolean shouldBackoff(org.apache.hc.core5.http.HttpResponse response)

      Determines whether receiving the given `HttpResponse` as a result of request execution should result in a backoff signal. Implementations MUST restrict themselves to examining the response header and MUST NOT consume any of the response body, if any.
      Parameters:
        `response` - the `HttpResponse` that was received
      Returns:
        `true` if a backoff signal should be given

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