@Test public void shouldUseGivenMaxValue() throws Exception { RequestException exception = mock(RequestException.class); assertTrue(toTest.retry(exception, 1)); assertTrue(toTest.retry(exception, 2)); assertFalse(toTest.retry(exception, 3)); }
public boolean retry(RequestException exception, int attemptNumber) throws Exception { boolean retry = attemptNumber <= max; LOG.debug("Retrying attempt=%d,max=%d,retry=%b,reason=%s", attemptNumber, max, retry, exception != null ? exception.getMessage() : "unknown"); return retry; }
MaxAttemptRetryHandler implements RetryHandler { public boolean retry(RequestException exception, int attemptNumber) throws Exception { boolean retry = attemptNumber <= max; LOG.debug("Retrying attempt=%d,max=%d,retry=%b,reason=%s", attemptNumber, max, retry, exception != null ? exception.getMessage() : "unknown"); return retry; } }
MaxAttemptRetryHandler implements RetryHandler { public boolean retry(RequestException exception, int attemptNumber) throws Exception { boolean retry = attemptNumber <= max; LOG.debug("Retrying attempt=%d,max=%d,retry=%b,reason=%s", attemptNumber, max, retry, exception != null ? exception.getMessage() : "unknown"); return retry; } MaxAttemptRetryHandler(CRestConfig crestConfig); }
MaxAttemptRetryHandler implements RetryHandler { public boolean retry(RequestException exception, int attemptNumber) throws Exception { boolean retry = attemptNumber <= max; LOG.debug("Retrying attempt=%d,max=%d,retry=%b,reason=%s", attemptNumber, max, retry, exception != null ? exception.getMessage() : "unknown"); return retry; } MaxAttemptRetryHandler(CRestConfig crestConfig); boolean retry(RequestException exception, int attemptNumber); }
MaxAttemptRetryHandler implements RetryHandler { public boolean retry(RequestException exception, int attemptNumber) throws Exception { boolean retry = attemptNumber <= max; LOG.debug("Retrying attempt=%d,max=%d,retry=%b,reason=%s", attemptNumber, max, retry, exception != null ? exception.getMessage() : "unknown"); return retry; } MaxAttemptRetryHandler(CRestConfig crestConfig); boolean retry(RequestException exception, int attemptNumber);  }