Home > Back-end >  @ Retryable maxAttempts Settings
@ Retryable maxAttempts Settings

Time:10-13

Set up a Retryable maxAttempts for 3, but carried out nine times?

CodePudding user response:

Because there is no written Recover method, have Recover method, will stop at maxAttempts;

CodePudding user response:

@ Slf4j
@ Service
Public class TestService {

@ Retryable (value=https://bbs.csdn.net/topics/Exception.class, maxAttempts=5, backoff=@ backoff (delay=1000 l, multiplier=1))
Public void process () {
The info (" Test error retry ");
OperateDataBase ();
Throw new RuntimeException (" Status error retry ");
}

@ Transactional (value="https://bbs.csdn.net/topics/transactionManager", rollbackFor.=the Exception class)
Public void operateDataBase () {
The info (" operate the DataBase ");
Throw new RuntimeException (" DataBase Error Rollback ");
}

@ Recover
Public void recover () {
The info (" recover from the error retry ");
}
}

CodePudding user response:

Don't and Transactional annotation RetryableRetryable annotations on the same method;
  • Related