Interface BackOffPolicy (1.45.0)

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
Type Description
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
Type Description
long

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

Exceptions
Type Description
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
Name Description
statusCode int

HTTP status code

Returns
Type Description
boolean

reset() (deprecated)

public abstract void reset()

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