backoff with jitter

This commit is contained in:
priyank-sriv 2019-07-22 00:55:41 +05:30
parent 412e8b7634
commit ae1807fca2
1 changed files with 6 additions and 0 deletions

View File

@ -65,6 +65,12 @@ public class BackoffWithJitterTest {
test(intervalFn);
}
@Test
public void whenRetryExponentialBackoffWithJitter_thenRetriesAreSpread() throws InterruptedException {
IntervalFunction intervalFn = ofExponentialRandomBackoff(INITIAL_INTERVAL, MULTIPLIER, RANDOMIZATION_FACTOR);
test(intervalFn);
}
private void test(IntervalFunction intervalFn) throws InterruptedException {
Function<String, String> pingPongFn = getRetryablePingPongFn(intervalFn);
ExecutorService executors = newFixedThreadPool(NUM_TASKS);