servicetalk-concurrent-api/src/main/java/io/servicetalk/concurrent/api/RepeatStrategies.java
/**
     * Creates a new repeat function that adds the passed constant {@link Duration} as delay between repeats.
     *
     * @param maxRepeats Maximum number of allowed repeats, after which the returned {@link IntFunction} will return
     *                   a failed {@link Completable} with {@link TerminateRepeatException} as the cause.
     * @param delay Constant {@link Duration} of delay between repeats.
     * @param jitter The jitter to apply to {@code delay} on each repeat.
     * @param timerExecutor {@link Executor} to be used to schedule timers for delay.
     *
     * @return An {@link IntFunction} to be used for repeats which given a repeat count returns a {@link Completable}
     * that terminates successfully when the source has to be repeated or terminates with error if the source should not
     * be repeated.
     */
Creates a new repeat function that adds the passed constant  Duration as delay between repeats.
@param maxRepeats Maximum number of allowed repeats, after which the returned  IntFunction will return
a failed  Completable with  TerminateRepeatException as the cause.
@param delay Constant  Duration of delay between repeats.
@param jitter The jitter to apply to  delay on each repeat.
@param timerExecutor  Executor to be used to schedule timers for delay.

@return An  IntFunction to be used for repeats which given a repeat count returns a  Completable
that terminates successfully when the source has to be repeated or terminates with error if the source should not
be repeated.
Creates a new repeat function that adds the passed constant Duration as delay between repeats . @param maxRepeats Maximum number of allowed repeats after which the returned IntFunction will return a failed Completable with TerminateRepeatException as the cause . @param delay Constant Duration of delay between repeats . @param jitter The jitter to apply to delay on each repeat . @param timerExecutor Executor to be used to schedule timers for delay . @return An IntFunction to be used for repeats which given a repeat count returns a Completable that terminates successfully when the source has to be repeated or terminates with error if the source should not be repeated .
public static IntFunction<Completable> repeatWithConstantBackoffDeltaJitter(final int maxRepeats,
                                                                                final Duration delay,
                                                                                final Duration jitter,
                                                                                final Executor timerExecutor) {
        checkMaxRetries(maxRepeats);
        requireNonNull(timerExecutor);
        final long delayNanos = delay.toNanos();
        final long jitterNanos = jitter.toNanos();
        checkJitterDelta(jitterNanos, delayNanos);
        final long lowerBound = delayNanos - jitterNanos;
        final long upperBound = delayNanos + jitterNanos;
        return repeatCount -> repeatCount <= maxRepeats ?
                timerExecutor.timer(current().nextLong(lowerBound, upperBound), NANOSECONDS) : terminateRepeat();
    }
public static IntFunction < Completable > repeatWithConstantBackoffDeltaJitter ( final int maxRepeats , final Duration delay , final Duration jitter , final Executor timerExecutor ) { checkMaxRetries ( maxRepeats ) ; requireNonNull ( timerExecutor ) ; final long delayNanos = delay . toNanos ( ) ; final long jitterNanos = jitter . toNanos ( ) ; checkJitterDelta ( jitterNanos , delayNanos ) ; final long lowerBound = delayNanos - jitterNanos ; final long upperBound = delayNanos + jitterNanos ; return repeatCount -> repeatCount <= maxRepeats ? timerExecutor . timer ( current ( ) . nextLong ( lowerBound , upperBound ) , NANOSECONDS ) : terminateRepeat ( ) ; }
Creates a new repeat function that adds the passed constant {@link Duration} as delay between repeats.
Creates a new repeat function that adds the passed constant { @link Duration } as delay between repeats .