我在这样的方法上使用@Retryable:
@Retryable( value = SQLException.class,
maxAttempts = 5, backoff = @Backoff(delay = 100))
void testMethod(String abc) throws SQLException{
//some method body that could throw sql exception
};
字符串
我想打印重试次数,并显示如下消息:
Retry Number : 1
Retry Number : 2
...
Retry Number : 5
型
我如何才能做到这一点?
2条答案
按热度按时间5tmbdcev1#
你可以添加下面的代码:
字符串
RetrySynchronizationManager.getContext().getRetryCount()将给予流的重试计数。
agyaoht72#
可以添加重试
字符串
重试计数应该像下面这样,你可以打印重试计数错误。
型