static RetryInfo newRetryInfo(RetryPolicy policy, Exception e, Counters counters, boolean idempotentOrAtMostOnce, long expectedFailoverCount) throws Exception { RetryAction max = null; long maxRetryDelay = 0; Exception ex = null; final Iterable<Exception> exceptions = e instanceof MultiException ? ((MultiException) e).getExceptions().values() : Collections.singletonList(e); for (Exception exception : exceptions) { final RetryAction a = policy.shouldRetry(exception, counters.retries, counters.failovers, idempotentOrAtMostOnce); if (a.action != RetryAction.RetryDecision.FAIL) { // must be a retry or failover if (a.delayMillis > maxRetryDelay) { maxRetryDelay = a.delayMillis; } } if (max == null || max.action.compareTo(a.action) < 0) { max = a; if (a.action == RetryAction.RetryDecision.FAIL) { ex = exception; } } } return new RetryInfo(maxRetryDelay, max, expectedFailoverCount, ex); }
static RetryInfo newRetryInfo(RetryPolicy policy, Exception e, Counters counters, boolean idempotentOrAtMostOnce, long expectedFailoverCount) throws Exception { RetryAction max = null; long maxRetryDelay = 0; Exception ex = null; final Iterable<Exception> exceptions = e instanceof MultiException ? ((MultiException) e).getExceptions().values() : Collections.singletonList(e); for (Exception exception : exceptions) { final RetryAction a = policy.shouldRetry(exception, counters.retries, counters.failovers, idempotentOrAtMostOnce); if (a.action != RetryAction.RetryDecision.FAIL) { // must be a retry or failover if (a.delayMillis > maxRetryDelay) { maxRetryDelay = a.delayMillis; } } if (max == null || max.action.compareTo(a.action) < 0) { max = a; if (a.action == RetryAction.RetryDecision.FAIL) { ex = exception; } } } return new RetryInfo(maxRetryDelay, max, expectedFailoverCount, ex); } }