java重试时间间隔,java – 如何以指数方式增加Spring RequestHandlerRetryAdvice中的重试间隔...

重试的具体规定如下:

class="org.springframework.integration.handler.advice.RequestHandlerRetryAdvice" >

我预计每次尝试时间间隔都会增加3倍.实际上我得到了以下间隔:

5,15,30,30,30秒.请参阅下面的确切时间和间隔.

我错误地指定了什么?

2016-05-10 10:07:49,714 - 0

2016-05-10 10:07:55,085 - 5.2

2016-05-10 10:08:10,457 - 15.4

2016-05-10 10:08:40,830 - 30.4

2016-05-10 10:09:11,230 - 30.4

2016-05-10 10:09:41,639 - 30.4

解决方法:

有maxInterval需要考虑:

/**

* Setter for maximum back off period. Default is 30000 (30 seconds). the

* value will be reset to 1 if this method is called with a value less than

* 1. Set this to avoid infinite waits if backing off a large number of

* times (or if the multiplier is set too high).

*

* @param maxInterval in milliseconds.

*/

public void setMaxInterval(long maxInterval) {

this.maxInterval = maxInterval > 0 ? maxInterval : 1;

}

因此,当您的ExponentialBackOffPolicy达到30秒(默认值)时,它将停止使用乘数.

标签:java,spring,spring-integration,spring-retry

来源: https://codeday.me/bug/20190527/1166861.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值