@Test public void testMaxRetryCount() throws Exception { ExponentialBackoffRetryHandler handler = new ExponentialBackoffRetryHandler(3, Duration.ZERO, Duration.ZERO, sleeper); doReturn(true).when(sleeper).sleep(any(Duration.class)); assertThat(handler.retryRequest(mock(IOException.class), 3), is(true)); assertThat(handler.retryRequest(mock(IOException.class), 4), is(false)); }
@Override public boolean retryRequest(IOException exception, int executionCount) { if (executionCount <= maxRetries) { Duration sleepTime = getSleepTime(executionCount); return sleeper.sleep(sleepTime); } else { return false; } }
ExponentialBackoffRetryHandler implements RetryHandler { @Override public boolean retryRequest(IOException exception, int executionCount) { if (executionCount <= maxRetries) { Duration sleepTime = getSleepTime(executionCount); return sleeper.sleep(sleepTime); } else { return false; } } }
ExponentialBackoffRetryHandler implements RetryHandler { @Override public boolean retryRequest(IOException exception, int executionCount) { if (executionCount <= maxRetries) { Duration sleepTime = getSleepTime(executionCount); return sleeper.sleep(sleepTime); } else { return false; } }  }
ExponentialBackoffRetryHandler implements RetryHandler { @Override public boolean retryRequest(IOException exception, int executionCount) { if (executionCount <= maxRetries) { Duration sleepTime = getSleepTime(executionCount); return sleeper.sleep(sleepTime); } else { return false; } }  @Override boolean retryRequest(IOException exception, int executionCount); }
ExponentialBackoffRetryHandler implements RetryHandler { @Override public boolean retryRequest(IOException exception, int executionCount) { if (executionCount <= maxRetries) { Duration sleepTime = getSleepTime(executionCount); return sleeper.sleep(sleepTime); } else { return false; } }  @Override boolean retryRequest(IOException exception, int executionCount);  }