@Test void testNextDelayCustomPolicy() { ExponentialBackoffPolicy exponentialBackoffPolicy = ExponentialBackoffPolicy .builder() .maxDelay(Duration.ofSeconds(60)) .backoffMultiplier(5) .build(); assertEquals(Duration.ofSeconds(50), exponentialBackoffPolicy.nextDelay(Duration.ofSeconds(10))); }
public Duration nextDelay(final Duration currentDelay) { if (currentDelay.compareTo(maxDelay) < 0) { return calculateNextDelay(currentDelay); } return maxDelay; }
ExponentialBackoffPolicy { public Duration nextDelay(final Duration currentDelay) { if (currentDelay.compareTo(maxDelay) < 0) { return calculateNextDelay(currentDelay); } return maxDelay; } }
ExponentialBackoffPolicy { public Duration nextDelay(final Duration currentDelay) { if (currentDelay.compareTo(maxDelay) < 0) { return calculateNextDelay(currentDelay); } return maxDelay; } @Builder  ExponentialBackoffPolicy(final Duration initialDelay,
                                    final Duration maxDelay,
                                    final int maxRetries,
                                    final int backoffMultiplier); private  ExponentialBackoffPolicy(); }
ExponentialBackoffPolicy { public Duration nextDelay(final Duration currentDelay) { if (currentDelay.compareTo(maxDelay) < 0) { return calculateNextDelay(currentDelay); } return maxDelay; } @Builder  ExponentialBackoffPolicy(final Duration initialDelay,
                                    final Duration maxDelay,
                                    final int maxRetries,
                                    final int backoffMultiplier); private  ExponentialBackoffPolicy(); Duration nextDelay(final Duration currentDelay); boolean reachedMaxRetries(final int retriesCount); }
ExponentialBackoffPolicy { public Duration nextDelay(final Duration currentDelay) { if (currentDelay.compareTo(maxDelay) < 0) { return calculateNextDelay(currentDelay); } return maxDelay; } @Builder  ExponentialBackoffPolicy(final Duration initialDelay,
                                    final Duration maxDelay,
                                    final int maxRetries,
                                    final int backoffMultiplier); private  ExponentialBackoffPolicy(); Duration nextDelay(final Duration currentDelay); boolean reachedMaxRetries(final int retriesCount); static final ExponentialBackoffPolicy DEFAULT; static final int UNLIMITED_RETRIES; }