guava-retrying, 재시도 도구 사용
1397 단어 시스템 구조
이전 인스턴스 코드:
/**
* guava retry
* false : 300 ms, 3
*/
static Retryer retryer = RetryerBuilder.newBuilder()
.retryIfExceptionOfType(RestClientException.class)
.retryIfResult(aBoolean -> Objects.equals(aBoolean, false))
.withWaitStrategy(WaitStrategies.fixedWait(300, TimeUnit.MILLISECONDS))
.withStopStrategy(StopStrategies.stopAfterAttempt(3))
.build();
호출:for (final String mobile : Mobiles) {
final SmsLog smsLog = new SmsLog(mobile, content);
Callable sendTask = () -> send(mobile, content);
try {
retryer.call(sendTask);
} catch (ExecutionException | RetryException e) {
logger.error(" , ");
}
}
private Boolean send(String mobile, String content) {
boolean success = true;
.....
return success;
}
여기에 사용 상세 정보를 추가하십시오.http://blog.csdn.net/aitangyong/article/details/53886293
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
SpringCloud 기반으로shard-Jdbc의 라이브러리 테이블 모드를 실현하고 데이터베이스 확장 방안순서대로 시작하고 서비스가 완전히 시작되면 다음 서비스가 시작됩니다. 그렇지 않으면 구덩이가 생길 수 있습니다. Feign 기반 호출 방식 역할: 두 개의 라이브러리 테이블 기반 데이터 조회 인터페이스 Feign 기...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.