backoff with jitter
This commit is contained in:
parent
412e8b7634
commit
ae1807fca2
@ -65,6 +65,12 @@ public class BackoffWithJitterTest {
|
|||||||
test(intervalFn);
|
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 {
|
private void test(IntervalFunction intervalFn) throws InterruptedException {
|
||||||
Function<String, String> pingPongFn = getRetryablePingPongFn(intervalFn);
|
Function<String, String> pingPongFn = getRetryablePingPongFn(intervalFn);
|
||||||
ExecutorService executors = newFixedThreadPool(NUM_TASKS);
|
ExecutorService executors = newFixedThreadPool(NUM_TASKS);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user