@Test void highBoundNormal() { double factor = 0.5; Duration min = Duration.ofMillis(-123); Duration max = Duration.ofMillis(1000); Duration delay = Duration.ofMillis(500); BackoffDelay bd = new BackoffDelay(min, max, delay); RandomJitter jitter = new RandomJitter(factor); assertThat(jitter.highJitterBound(bd, 250)) .isEqualTo(250); }
long highJitterBound(BackoffDelay backoff, long jitterOffset) { return Math.min( backoff.max.minus(backoff.delay).toMillis(), jitterOffset); }
RandomJitter implements Jitter { long highJitterBound(BackoffDelay backoff, long jitterOffset) { return Math.min( backoff.max.minus(backoff.delay).toMillis(), jitterOffset); } }
RandomJitter implements Jitter { long highJitterBound(BackoffDelay backoff, long jitterOffset) { return Math.min( backoff.max.minus(backoff.delay).toMillis(), jitterOffset); } RandomJitter(double randomFactor); }
RandomJitter implements Jitter { long highJitterBound(BackoffDelay backoff, long jitterOffset) { return Math.min( backoff.max.minus(backoff.delay).toMillis(), jitterOffset); } RandomJitter(double randomFactor); @Override Duration apply(BackoffDelay backoff); @Override String toString(); }
RandomJitter implements Jitter { long highJitterBound(BackoffDelay backoff, long jitterOffset) { return Math.min( backoff.max.minus(backoff.delay).toMillis(), jitterOffset); } RandomJitter(double randomFactor); @Override Duration apply(BackoffDelay backoff); @Override String toString();  }