/** * Constructs a {@link RandomIterator} for numbers between * 0 and the specified range (exclusive). * * @param range the upper bound of the range */ public RandomIterator(long range) { this(new PerpetualIterator<Long>(range)); }
@Override public Iterator<Action<A, G>> getActions() { return new PerpetualIterator<Action<A, G>>(action); } }
/** * Obtains an ensured of the specified {@link Deferred}. * * @param deferred the {@link Deferred} to ensure * @param retryDelayDuration the time to wait between retrying * @param retryDelayDurationUnits the {@link TimeUnit}s for the retry delay duration * @param totalRetryDuration the maximum duration for retrying * @param totalRetryDurationUnits the {@link TimeUnit}s for the duration * * @return an {@link Ensured} of the {@link Deferred} */ public static <T> Deferred<T> ensured(Deferred<T> deferred, long retryDelayDuration, TimeUnit retryDelayDurationUnits, long totalRetryDuration, TimeUnit totalRetryDurationUnits) { Iterator<Long> retryDurationsMS = new PerpetualIterator<Long>(retryDelayDurationUnits.toMillis(retryDelayDuration < 0 ? 0 : retryDelayDuration)); return deferred instanceof Ensured ? deferred : new Ensured<T>(deferred, retryDurationsMS, totalRetryDurationUnits .toMillis(totalRetryDuration)); }
return new PerpetualIterator<Long>(250L);