@Test public void testBackoffCauseFilter() { testCauseFilter(retryWithConstantBackoff(1, cause -> cause instanceof IllegalStateException, ofSeconds(1), timerExecutor)); }
public static BiIntFunction<Throwable, Completable> retryWithConstantBackoff(final int maxRetries, final Predicate<Throwable> causeFilter, final Duration delay, final Executor timerExecutor) { checkMaxRetries(maxRetries); requireNonNull(timerExecutor); requireNonNull(causeFilter); final long delayNanos = delay.toNanos(); return (retryCount, cause) -> { if (retryCount > maxRetries || !causeFilter.test(cause)) { return failed(cause); } return timerExecutor.timer(delayNanos, NANOSECONDS); }; }
RetryStrategies { public static BiIntFunction<Throwable, Completable> retryWithConstantBackoff(final int maxRetries, final Predicate<Throwable> causeFilter, final Duration delay, final Executor timerExecutor) { checkMaxRetries(maxRetries); requireNonNull(timerExecutor); requireNonNull(causeFilter); final long delayNanos = delay.toNanos(); return (retryCount, cause) -> { if (retryCount > maxRetries || !causeFilter.test(cause)) { return failed(cause); } return timerExecutor.timer(delayNanos, NANOSECONDS); }; } }
RetryStrategies { public static BiIntFunction<Throwable, Completable> retryWithConstantBackoff(final int maxRetries, final Predicate<Throwable> causeFilter, final Duration delay, final Executor timerExecutor) { checkMaxRetries(maxRetries); requireNonNull(timerExecutor); requireNonNull(causeFilter); final long delayNanos = delay.toNanos(); return (retryCount, cause) -> { if (retryCount > maxRetries || !causeFilter.test(cause)) { return failed(cause); } return timerExecutor.timer(delayNanos, NANOSECONDS); }; } private  RetryStrategies(); }
RetryStrategies { public static BiIntFunction<Throwable, Completable> retryWithConstantBackoff(final int maxRetries, final Predicate<Throwable> causeFilter, final Duration delay, final Executor timerExecutor) { checkMaxRetries(maxRetries); requireNonNull(timerExecutor); requireNonNull(causeFilter); final long delayNanos = delay.toNanos(); return (retryCount, cause) -> { if (retryCount > maxRetries || !causeFilter.test(cause)) { return failed(cause); } return timerExecutor.timer(delayNanos, NANOSECONDS); }; } private  RetryStrategies(); static BiIntFunction<Throwable, Completable> retryWithConstantBackoff(final int maxRetries,
                                                                                 final Predicate<Throwable> causeFilter,
                                                                                 final Duration delay,
                                                                                 final Executor timerExecutor); static BiIntFunction<Throwable, Completable> retryWithConstantBackoffAndJitter(
            final int maxRetries,
            final Predicate<Throwable> causeFilter,
            final Duration delay,
            final Executor timerExecutor); static BiIntFunction<Throwable, Completable> retryWithExponentialBackoff(
            final int maxRetries,
            final Predicate<Throwable> causeFilter,
            final Duration initialDelay,
            final Executor timerExecutor); static BiIntFunction<Throwable, Completable> retryWithExponentialBackoffAndJitter(
            final int maxRetries,
            final Predicate<Throwable> causeFilter,
            final Duration initialDelay,
            final Executor timerExecutor); }
RetryStrategies { public static BiIntFunction<Throwable, Completable> retryWithConstantBackoff(final int maxRetries, final Predicate<Throwable> causeFilter, final Duration delay, final Executor timerExecutor) { checkMaxRetries(maxRetries); requireNonNull(timerExecutor); requireNonNull(causeFilter); final long delayNanos = delay.toNanos(); return (retryCount, cause) -> { if (retryCount > maxRetries || !causeFilter.test(cause)) { return failed(cause); } return timerExecutor.timer(delayNanos, NANOSECONDS); }; } private  RetryStrategies(); static BiIntFunction<Throwable, Completable> retryWithConstantBackoff(final int maxRetries,
                                                                                 final Predicate<Throwable> causeFilter,
                                                                                 final Duration delay,
                                                                                 final Executor timerExecutor); static BiIntFunction<Throwable, Completable> retryWithConstantBackoffAndJitter(
            final int maxRetries,
            final Predicate<Throwable> causeFilter,
            final Duration delay,
            final Executor timerExecutor); static BiIntFunction<Throwable, Completable> retryWithExponentialBackoff(
            final int maxRetries,
            final Predicate<Throwable> causeFilter,
            final Duration initialDelay,
            final Executor timerExecutor); static BiIntFunction<Throwable, Completable> retryWithExponentialBackoffAndJitter(
            final int maxRetries,
            final Predicate<Throwable> causeFilter,
            final Duration initialDelay,
            final Executor timerExecutor);  }