Top Description Fields Constructors Methods
org.apache.http.impl.client

public Class DefaultServiceUnavailableRetryStrategy

extends Object
implements ServiceUnavailableRetryStrategy
Class Inheritance
All Implemented Interfaces
org.apache.http.client.ServiceUnavailableRetryStrategy
Annotations
@Contract
threading:IMMUTABLE
Imports
org.apache.http.HttpResponse, .HttpStatus, org.apache.http.annotation.Contract, .ThreadingBehavior, org.apache.http.client.ServiceUnavailableRetryStrategy, org.apache.http.protocol.HttpContext, org.apache.http.util.Args

Default implementation of the ServiceUnavailableRetryStrategy interface. that retries 503 (Service Unavailable) responses for a fixed number of times at a fixed interval.
Since
4.2

Field Summary

Modifier and TypeField and Description
private final int
maxRetries

Maximum number of allowed retries if the server responds with a HTTP code in our retry code list.

private final long
retryInterval

Retry interval between subsequent requests, in milliseconds.

Constructor Summary

AccessConstructor and Description
public
DefaultServiceUnavailableRetryStrategy(final int maxRetries, final int retryInterval)

public

Method Summary

Modifier and TypeMethod and Description
public long
public boolean
retryRequest(final HttpResponse
the response from the target server
response
,
final int
the number of times this method has been unsuccessfully executed
executionCount
,
final HttpContext
the context for the request execution
context
)

Implements org.apache.http.client.ServiceUnavailableRetryStrategy.retryRequest.

Determines if a method should be retried given the response from the target server.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

maxRetriesback to summary
private final int maxRetries

Maximum number of allowed retries if the server responds with a HTTP code in our retry code list. Default value is 1.

retryIntervalback to summary
private final long retryInterval

Retry interval between subsequent requests, in milliseconds. Default value is 1 second.

Constructor Detail

DefaultServiceUnavailableRetryStrategyback to summary
public DefaultServiceUnavailableRetryStrategy(final int maxRetries, final int retryInterval)
DefaultServiceUnavailableRetryStrategyback to summary
public DefaultServiceUnavailableRetryStrategy()

Method Detail

getRetryIntervalback to summary
public long getRetryInterval()

Implements org.apache.http.client.ServiceUnavailableRetryStrategy.getRetryInterval.

Returns:long

Doc from org.apache.http.client.ServiceUnavailableRetryStrategy.getRetryInterval.

The interval between the subsequent auto-retries.

Annotations
@Override
retryRequestback to summary
public boolean retryRequest(final HttpResponse response, final int executionCount, final HttpContext context)

Implements org.apache.http.client.ServiceUnavailableRetryStrategy.retryRequest.

Doc from org.apache.http.client.ServiceUnavailableRetryStrategy.retryRequest.

Determines if a method should be retried given the response from the target server.

Parameters
response:HttpResponse

the response from the target server

executionCount:int

the number of times this method has been unsuccessfully executed

context:HttpContext

the context for the request execution

Returns:boolean

true if the method should be retried, false otherwise

Annotations
@Override