Class DefaultRetry<T>
- java.lang.Object
-
- com.couchbase.client.core.retry.reactor.AbstractRetry<T,Throwable>
-
- com.couchbase.client.core.retry.reactor.DefaultRetry<T>
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description org.reactivestreams.Publisher<Long>
apply(Flux<Throwable> errors)
Retry<T>
backoff(Backoff backoff)
Returns a retry function with backoff delay.static <T> DefaultRetry<T>
create(Predicate<? super RetryContext<T>> retryPredicate)
Retry<T>
doOnRetry(Consumer<? super RetryContext<T>> onRetry)
Returns a retry function that invokes the provided onRetry callback before every retry.Retry<T>
jitter(Jitter jitter)
Returns a retry function that applies jitter to the backoff delay.Retry<T>
retryMax(long maxIterations)
Retry function that retries n times.Retry<T>
timeout(Duration timeout)
Returns a retry function with timeout.String
toString()
Retry<T>
withApplicationContext(T applicationContext)
Returns a retry function with an application context that may be used to perform any rollbacks before a retry.Retry<T>
withBackoffScheduler(Scheduler scheduler)
Returns a retry 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.Retry
apply, exponentialBackoff, exponentialBackoffWithJitter, fixedBackoff, noBackoff, randomBackoff, retryOnce, toReactorRetry
-
-
-
-
Method Detail
-
create
public static <T> DefaultRetry<T> create(Predicate<? super RetryContext<T>> retryPredicate)
-
withApplicationContext
public Retry<T> withApplicationContext(T applicationContext)
Description copied from interface:Retry
Returns a retry function with an application context that may be used to perform any rollbacks before a retry. This application context is provided to any retry predicateRetry.onlyIf(Predicate)
, custom backoff functionRetry.backoff(Backoff)
and retry callbackRetry.doOnRetry(Consumer)
. All other properties of this retry function are retained in the returned instance.- Specified by:
withApplicationContext
in interfaceRetry<T>
- Parameters:
applicationContext
- Application context- Returns:
- retry function with associated application context
-
doOnRetry
public Retry<T> doOnRetry(Consumer<? super RetryContext<T>> onRetry)
Description copied from interface:Retry
Returns a retry function that invokes the provided onRetry callback before every retry. TheRetryContext
provided to the callback contains the iteration and the any application context set usingRetry.withApplicationContext(Object)
. All other properties of this retry function are retained in the returned instance.
-
retryMax
public Retry<T> retryMax(long maxIterations)
Description copied from interface:Retry
Retry function that retries n times.
-
timeout
public Retry<T> timeout(Duration timeout)
Description copied from interface:Retry
Returns a retry function with timeout. The timeout starts from the instant that this function is applied, and the function keeps retrying until the timeout expires (or until the configured maximum number of attempts, if it has been set). All other properties of this retry function are retained in the returned instance.
-
backoff
public Retry<T> backoff(Backoff backoff)
Description copied from interface:Retry
Returns a retry function with backoff delay. All other properties of this retry function are retained in the returned instance.
-
jitter
public Retry<T> jitter(Jitter jitter)
Description copied from interface:Retry
Returns a retry function that applies jitter to the backoff delay. All other properties of this retry function are retained in the returned instance.
-
withBackoffScheduler
public Retry<T> withBackoffScheduler(Scheduler scheduler)
Description copied from interface:Retry
Returns a retry function that uses the scheduler provided for backoff delays. All other properties of this retry function are retained in the returned instance.- Specified by:
withBackoffScheduler
in interfaceRetry<T>
- Parameters:
scheduler
- the scheduler for backoff delays- Returns:
- retry function with backoff scheduler
-
-