Top Description Constructors Methods
org.apache.hc.client5.http.impl.classic

public Class DefaultBackoffStrategy

extends Object
implements ConnectionBackoffStrategy
Class Inheritance
All Implemented Interfaces
org.apache.hc.client5.http.classic.ConnectionBackoffStrategy
Annotations
@Experimental
Imports
java.net.ConnectException, .SocketTimeoutException, org.apache.hc.client5.http.classic.ConnectionBackoffStrategy, org.apache.hc.core5.annotation.Experimental, org.apache.hc.core5.http.HttpResponse, .HttpStatus

This ConnectionBackoffStrategy backs off either for a raw network socket or connection timeout or if the server explicitly sends a 429 (Too Many Requests) or a 503 (Service Unavailable) response.
Since
4.2

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
shouldBackoff(final Throwable
the Throwable that happened
t
)

Implements org.apache.hc.client5.http.classic.ConnectionBackoffStrategy.shouldBackoff.

Determines whether seeing the given Throwable as a result of request execution should result in a backoff signal.
public boolean
shouldBackoff(final HttpResponse
the HttpResponse that was received
response
)

Implements org.apache.hc.client5.http.classic.ConnectionBackoffStrategy.shouldBackoff.

Determines whether receiving the given HttpResponse as a result of request execution should result in a backoff signal.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

DefaultBackoffStrategyback to summary
public DefaultBackoffStrategy()

Method Detail

shouldBackoffback to summary
public boolean shouldBackoff(final Throwable t)

Implements org.apache.hc.client5.http.classic.ConnectionBackoffStrategy.shouldBackoff.

Doc from org.apache.hc.client5.http.classic.ConnectionBackoffStrategy.shouldBackoff.

Determines whether seeing the given Throwable as a result of request execution should result in a backoff signal.

Parameters
t:Throwable

the Throwable that happened

Returns:boolean

true if a backoff signal should be given

Annotations
@Override
shouldBackoffback to summary
public boolean shouldBackoff(final HttpResponse response)

Implements org.apache.hc.client5.http.classic.ConnectionBackoffStrategy.shouldBackoff.

Doc from org.apache.hc.client5.http.classic.ConnectionBackoffStrategy.shouldBackoff.

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:HttpResponse

the HttpResponse that was received

Returns:boolean

true if a backoff signal should be given

Annotations
@Override