@Contract(threading=IMMUTABLE) public class DefaultHttpRequestRetryHandler extends Object implements HttpRequestRetryHandler
HttpRequestRetryHandler 。
| Modifier and Type | Field and Description |
|---|---|
static DefaultHttpRequestRetryHandler |
INSTANCE |
| Modifier | Constructor and Description |
|---|---|
|
DefaultHttpRequestRetryHandler()
创建请求重试处理程序,重试次数为3,requestSentRetryEnabled为false,并使用以下不可重复的IOException类列表:
InterruptedIOException UnknownHostException ConnectException SSLException |
|
DefaultHttpRequestRetryHandler(int retryCount, boolean requestSentRetryEnabled)
使用以下不可重复的IOException类列表创建请求重试处理程序:
InterruptedIOException UnknownHostException ConnectException SSLException |
protected |
DefaultHttpRequestRetryHandler(int retryCount, boolean requestSentRetryEnabled, Collection<Class<? extends IOException>> clazzes)
使用指定的IOException类创建请求重试处理程序
|
| Modifier and Type | Method and Description |
|---|---|
int |
getRetryCount() |
protected boolean |
handleAsIdempotent(HttpRequest request) |
boolean |
isRequestSentRetryEnabled() |
protected boolean |
requestIsAborted(HttpRequest request)
已过时。
(4.3)
|
boolean |
retryRequest(IOException exception, int executionCount, HttpContext context)
使用
retryCount和
requestSentRetryEnabled来确定是否应该重试给定的方法。
|
public static final DefaultHttpRequestRetryHandler INSTANCE
protected DefaultHttpRequestRetryHandler(int retryCount,
boolean requestSentRetryEnabled,
Collection<Class<? extends IOException>> clazzes)
retryCount - 多次重试;
0表示不重试
requestSentRetryEnabled - 如果可以重试已发送的请求,
requestSentRetryEnabled true
clazzes - 不应重试的IOException类型
public DefaultHttpRequestRetryHandler(int retryCount,
boolean requestSentRetryEnabled)
retryCount - 多次重试;
0表示不重试
requestSentRetryEnabled - 如果可以重试已发送的非幂等请求,
requestSentRetryEnabled true
public DefaultHttpRequestRetryHandler()
public boolean retryRequest(IOException exception, int executionCount, HttpContext context)
retryCount和
requestSentRetryEnabled来确定是否应重试给定的方法。
retryRequest在接口
HttpRequestRetryHandler
exception - 发生的异常
executionCount - 此方法未成功执行的次数
context - 请求执行的上下文
true如果该方法应该重试,否则
false
public boolean isRequestSentRetryEnabled()
true如果此处理程序将重试已成功发送请求的方法,
false否则
public int getRetryCount()
protected boolean handleAsIdempotent(HttpRequest request)
@Deprecated protected boolean requestIsAborted(HttpRequest request)
Copyright © 1999–2017 The Apache Software Foundation. All rights reserved.