사용자 도구

사이트 도구


springframework:retry

Spring Retry

Simple Example

RetryTemplate retryTemplate = new RetryTemplate();
  
FixedBackOffPolicy fixedBackOffPolicy = new FixedBackOffPolicy();
fixedBackOffPolicy.setBackOffPeriod(2000l);
retryTemplate.setBackOffPolicy(fixedBackOffPolicy);
 
SimpleRetryPolicy retryPolicy = new SimpleRetryPolicy();
retryPolicy.setMaxAttempts(2);
retryTemplate.setRetryPolicy(retryPolicy);
 
retryTemplate.execute(new RetryCallback<Void, RuntimeException>() {
    @Override
    public Void doWithRetry(RetryContext arg0) {
        myService.templateRetryService();
        ...
    }
});

참조

springframework/retry.txt · 마지막으로 수정됨: 2021/10/05 17:00 저자 kwon37xi