apache的HttpClient的默认重试机制

更新时间:2023-07-05 20:03:45 阅读: 评论:0

apache 的HttpClient 的默认重试机制
maven
异常重试log
RetryExec
org/apache/http/impl/execchain/RetryExec.java
DefaultHttpRequestRetryHandler
org/apache/http/impl/client/DefaultHttpRequestRetryHandler.java
<dependency>
<groupId>org.apache.httpcomponents </groupId>
兵马俑<artifactId>httpclient </artifactId>
<version>4.5.2</version>
</dependency>
2017-01-31 19:31:39.057  INFO  3873 --- [askScheduler-13] o.apache.hain.RetryExec    : I/O  exception  (org.apache.http.NoHttpRespon Exception) caught  when  processing  request  to  {}->192.168.99.100:8080: The  target  rver  failed  to  respond
2017-01-31 19:31:39.058  INFO  3873 --- [askScheduler-13] o.apache.hain.RetryExec    : Retrying  request  to  {}->192.168.99.100:8
080
心旷神怡什么意思
/**
* Request executor in the request execution chain that is responsible
我的年度关键词* for making a decision whether a request failed due to an I/O error
* should be re-executed.
* <p>
* Further responsibilities such as communication with the opposite
* endpoint is delegated to the next executor in the request execution
* chain.
* </p>
*
* @since  4.3
*/
@Immutable
public  class  RetryExec  implements  ClientExecChain  {
private  final  Log log = Log(getClass());
private  final  ClientExecChain requestExecutor;挑染头发图片
private  final  HttpRequestRetryHandler retryHandler;
public  RetryExec(
final  ClientExecChain requestExecutor,
final  HttpRequestRetryHandler retryHandler) {
默认重试3次,三次都失败则抛出NoHttpResponException或其他异常
doc /**脆性x综合症
* The default {@link  HttpRequestRetryHandler} ud by request executors.
*
* @since  4.0
*/
保马@Immutable与其造句
public  class  DefaultHttpRequestRetryHandler  implements  HttpRequestRetryHandler  {    public  static  final  DefaultHttpRequestRetryHandler INSTANCE = new  DefaultHttpRequestRetryHandler();    /** the number of times a method will be retried */
private  final  int  retryCount;
/** Whether or not methods that have successfully nt their request will be retried */    private  final  boolean  requestSentRetryEnabled;
一处相思两处闲愁
private  final  Set<Class<? extends  IOException>> nonRetriableClass;
/**
* Create the request retry handler using the specified IOException class
*
* @param  retryCount how many times to retry; 0 means no retries
* @param  requestSentRetryEnabled true if it's OK to retry requests that have been nt

本文发布于:2023-07-05 20:03:45,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/89/1069235.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:默认   重试   挑染   年度   抛出
相关文章
留言与评论(共有 0 条评论)
   
验证码:
推荐文章
排行榜
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图