daily pastebin goal
6%
SHARE
TWEET

Untitled

a guest Jul 11th, 2018 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @Service
  2.  public class TestService {
  3.  
  4.  @Retryable(value = {SomeException.class, MyException.class},
  5.    maxAttempts = 3,backoff = @Backoff(2000))
  6.  public void retryWhenException() {
  7.  try{
  8.     // perform operation that can fail
  9.  }catch(SomeException se){
  10.     // will be retried
  11.     throw se;
  12.  }catch(MyException me){
  13.     // will be retried
  14.     throw me;
  15.  }catch(Exception e){
  16.     // will not be retried
  17.     throw e;
  18.  }
  19. }
  20.  
  21. @Recover
  22. public void recover(SomeException exception) {
  23.  // recover from SomeException
  24.  }
  25. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top