Class DefaultRepeat<T>
- java.lang.Object
-
- com.couchbase.client.core.retry.reactor.AbstractRetry<T,Long>
-
- com.couchbase.client.core.retry.reactor.DefaultRepeat<T>
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description org.reactivestreams.Publisher<Long>
apply(Flux<Long> companionValues)
Repeat<T>
backoff(Backoff backoff)
Returns a repeat function with backoff delay.static <T> DefaultRepeat<T>
create(Predicate<? super RepeatContext<T>> repeatPredicate, long n)
Repeat function that repeats n times, only if the predicate returns true.Repeat<T>
doOnRepeat(Consumer<? super RepeatContext<T>> onRepeat)
Returns a repeat function that invokes the provided onRepeat callback before every repeat.Repeat<T>
jitter(Jitter jitter)
Returns a repeat function that applies jitter to the backoff delay.Repeat<T>
repeatMax(long maxRepeats)
Returns a repeat function that repeats at most n times.Repeat<T>
timeout(Duration timeout)
Returns a repeat function with timeout.String
toString()
Repeat<T>
withApplicationContext(T applicationContext)
Returns a repeat function with an application context that may be used to perform any rollbacks before a repeat.Repeat<T>
withBackoffScheduler(Scheduler scheduler)
Returns a repeat function that uses the scheduler provided for backoff delays.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.couchbase.client.core.retry.reactor.Repeat
apply, exponentialBackoff, exponentialBackoffWithJitter, fixedBackoff, noBackoff, randomBackoff
-
-
-
-
Method Detail
-
create
public static <T> DefaultRepeat<T> create(Predicate<? super RepeatContext<T>> repeatPredicate, long n)
Description copied from interface:Repeat
Repeat function that repeats n times, only if the predicate returns true.- Parameters:
repeatPredicate
- Predicate that determines if next repeat is performedn
- number of repeats- Returns:
- Repeat function with predicate and n repeats
-
withApplicationContext
public Repeat<T> withApplicationContext(T applicationContext)
Description copied from interface:Repeat
Returns a repeat function with an application context that may be used to perform any rollbacks before a repeat. This application context is provided to any repeat predicateRepeat.onlyIf(Predicate)
, custom backoff functionRepeat.backoff(Backoff)
and repeat callbackRepeat.doOnRepeat(Consumer)
. All other properties of this repeat function are retained in the returned instance.- Specified by:
withApplicationContext
in interfaceRepeat<T>
- Parameters:
applicationContext
- Application context- Returns:
- repeat function with associated application context
-
doOnRepeat
public Repeat<T> doOnRepeat(Consumer<? super RepeatContext<T>> onRepeat)
Description copied from interface:Repeat
Returns a repeat function that invokes the provided onRepeat callback before every repeat. TheRepeatContext
provided to the callback contains the iteration and the any application context set usingRepeat.withApplicationContext(Object)
. All other properties of this repeat function are retained in the returned instance.- Specified by:
doOnRepeat
in interfaceRepeat<T>
- Parameters:
onRepeat
- callback to invoke before repeats- Returns:
- repeat function with callback
-
timeout
public Repeat<T> timeout(Duration timeout)
Description copied from interface:Repeat
Returns a repeat function with timeout. The timeout starts from the instant that this function is applied and switches to unlimited number of attempts. All other properties of this repeat function are retained in the returned instance.
-
repeatMax
public Repeat<T> repeatMax(long maxRepeats)
Description copied from interface:Repeat
Returns a repeat function that repeats at most n times. All other properties of this repeat function are retained in the returned instance.
-
backoff
public Repeat<T> backoff(Backoff backoff)
Description copied from interface:Repeat
Returns a repeat function with backoff delay. All other properties of this repeat function are retained in the returned instance.
-
jitter
public Repeat<T> jitter(Jitter jitter)
Description copied from interface:Repeat
Returns a repeat function that applies jitter to the backoff delay. All other properties of this repeat function are retained in the returned instance.
-
withBackoffScheduler
public Repeat<T> withBackoffScheduler(Scheduler scheduler)
Description copied from interface:Repeat
Returns a repeat function that uses the scheduler provided for backoff delays. All other properties of this repeat function are retained in the returned instance.- Specified by:
withBackoffScheduler
in interfaceRepeat<T>
- Parameters:
scheduler
- the scheduler for backoff delays- Returns:
- repeat function with backoff scheduler
-
-