@Test void getInterval_shouldApplyMultiplier() { BackoffRetryInterval interval = new BackoffRetryInterval(1000, 2, 10000); assertThat(interval.getInterval(new RetryContext(1, null, null))) .isEqualTo(1000); assertThat(interval.getInterval(new RetryContext(2, null, null))) .isEqualTo(2000); assertThat(interval.getInterval(new RetryContext(3, null, null))) .isEqualTo(4000); }
@Override public long getInterval(RetryContext retryContext) { if (retryContext.getAttempts() == 1) { return this.interval; } long interval = (retryContext.getAttempts() - 1) * (this.interval * this.multiplier); return (interval < this.maxInterval) ? interval : this.maxInterval; }
BackoffRetryInterval implements RetryInterval { @Override public long getInterval(RetryContext retryContext) { if (retryContext.getAttempts() == 1) { return this.interval; } long interval = (retryContext.getAttempts() - 1) * (this.interval * this.multiplier); return (interval < this.maxInterval) ? interval : this.maxInterval; } }
BackoffRetryInterval implements RetryInterval { @Override public long getInterval(RetryContext retryContext) { if (retryContext.getAttempts() == 1) { return this.interval; } long interval = (retryContext.getAttempts() - 1) * (this.interval * this.multiplier); return (interval < this.maxInterval) ? interval : this.maxInterval; } BackoffRetryInterval(long interval, long multiplier, long maxInterval); }
BackoffRetryInterval implements RetryInterval { @Override public long getInterval(RetryContext retryContext) { if (retryContext.getAttempts() == 1) { return this.interval; } long interval = (retryContext.getAttempts() - 1) * (this.interval * this.multiplier); return (interval < this.maxInterval) ? interval : this.maxInterval; } BackoffRetryInterval(long interval, long multiplier, long maxInterval); @Override long getInterval(RetryContext retryContext); }
BackoffRetryInterval implements RetryInterval { @Override public long getInterval(RetryContext retryContext) { if (retryContext.getAttempts() == 1) { return this.interval; } long interval = (retryContext.getAttempts() - 1) * (this.interval * this.multiplier); return (interval < this.maxInterval) ? interval : this.maxInterval; } BackoffRetryInterval(long interval, long multiplier, long maxInterval); @Override long getInterval(RetryContext retryContext);  }