Package org.apache.http.impl.client
Class DefaultBackoffStrategy
- java.lang.Object
-
- org.apache.http.impl.client.DefaultBackoffStrategy
-
- All Implemented Interfaces:
ConnectionBackoffStrategy
public class DefaultBackoffStrategy extends java.lang.Object implements ConnectionBackoffStrategy
ThisConnectionBackoffStrategy
backs off either for a raw network socket or connection timeout or if the server explicitly sends a 503 (Service Unavailable) response.- Since:
- 4.2
-
-
Constructor Summary
Constructors Constructor Description DefaultBackoffStrategy()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
shouldBackoff(java.lang.Throwable t)
Determines whether seeing the givenThrowable
as a result of request execution should result in a backoff signal.boolean
shouldBackoff(HttpResponse resp)
Determines whether receiving the givenHttpResponse
as a result of request execution should result in a backoff signal.
-
-
-
Method Detail
-
shouldBackoff
public boolean shouldBackoff(java.lang.Throwable t)
Description copied from interface:ConnectionBackoffStrategy
Determines whether seeing the givenThrowable
as a result of request execution should result in a backoff signal.- Specified by:
shouldBackoff
in interfaceConnectionBackoffStrategy
- Parameters:
t
- theThrowable
that happened- Returns:
true
if a backoff signal should be given
-
shouldBackoff
public boolean shouldBackoff(HttpResponse resp)
Description copied from interface:ConnectionBackoffStrategy
Determines whether receiving the givenHttpResponse
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.- Specified by:
shouldBackoff
in interfaceConnectionBackoffStrategy
- Parameters:
resp
- theHttpResponse
that was received- Returns:
true
if a backoff signal should be given
-
-