Interface BackOffPolicy (1.42.3)

public interface BackOffPolicy

Deprecated. (scheduled to be removed in 1.18) Use HttpBackOffUnsuccessfulResponseHandler instead.

Beta
Strategy interface to control back off between retry attempts.

Static Fields

STOP (deprecated)

public static final long STOP

Value indicating that no more retries should be made, see #getNextBackOffMillis().

Field Value
TypeDescription
long

Methods

getNextBackOffMillis() (deprecated)

public abstract long getNextBackOffMillis()

Gets the number of milliseconds to wait before retrying an HTTP request. If #STOP is returned, no retries should be made.

This method should be used as follows:

long backoffTime = backoffPolicy.getNextBackoffMs(); if (backoffTime == BackoffPolicy.STOP) { // Stop retrying. } else { // Retry after backoffTime. }

Returns
TypeDescription
long

the number of milliseconds to wait when backing off requests, or #STOP if no more retries should be made

Exceptions
TypeDescription
IOException

isBackOffRequired(int statusCode) (deprecated)

public abstract boolean isBackOffRequired(int statusCode)

Determines if back off is required based on the specified status code.

Implementations may want to back off on server or product-specific errors.

Parameter
NameDescription
statusCodeint

HTTP status code

Returns
TypeDescription
boolean

reset() (deprecated)

public abstract void reset()

Reset Back off counters (if any) in an implementation-specific fashion.