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
Modifier and TypeMethodDescriptionorg.reactivestreams.Publisher
<Long> Returns a repeat function with backoff delay.static <T> DefaultRepeat
<T> create
(Predicate<? super RepeatContext<T>> repeatPredicate, long n) doOnRepeat
(Consumer<? super RepeatContext<T>> onRepeat) Returns a repeat function that invokes the provided onRepeat callback before every repeat.Returns a repeat function that applies jitter to the backoff delay.repeatMax
(long maxRepeats) Returns a repeat function that repeats at most n times.Returns a repeat function with timeout.toString()
withApplicationContext
(T applicationContext) Returns a repeat function with an application context that may be used to perform any rollbacks before a repeat.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 Details
-
create
public static <T> DefaultRepeat<T> create(Predicate<? super RepeatContext<T>> repeatPredicate, long n) -
withApplicationContext
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
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
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
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
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
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
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
-
apply
-
toString
-