Код: Выделить всё
// MyRetryableException is a RuntimeException
@Retryable(retryFor = MyRetryableException.class, maxAttempts = 3)
public void doSomething(String s) throws JustGiveUpException {
final var response = talkToSomething(s);
if (response.getStatus().equals("retryableProblem")) {
throw new MyRetryableException(s);
else if (response.getStatus().equals("someOtherProblem")) {
throw new JustGiveUpException(s);
}
}
// UnableToCommunicateException is a RuntimeException
@Recover
public void handleFailedRetries(MyRetryableException e, String s) {
throw new UnableToCommunicateException(s);
}
Почему это происходит? Я говорю о повторной аннотации , что оно должно повторно повторить MyRetryableException . Так почему же он пытается повторно повторно/восстановиться на другом исключении?
Подробнее здесь: https://stackoverflow.com/questions/796 ... exceptions