Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Service
- public class TestService {
- @Retryable(value = {SomeException.class, MyException.class},
- maxAttempts = 3,backoff = @Backoff(2000))
- public void retryWhenException() {
- try{
- // perform operation that can fail
- }catch(SomeException se){
- // will be retried
- throw se;
- }catch(MyException me){
- // will be retried
- throw me;
- }catch(Exception e){
- // will not be retried
- throw e;
- }
- }
- @Recover
- public void recover(SomeException exception) {
- // recover from SomeException
- }
- }
Add Comment
Please, Sign In to add comment