Class DefaultContext<T>
java.lang.Object
com.couchbase.client.core.retry.reactor.DefaultContext<T>
- All Implemented Interfaces:
IterationContext<T>
,RepeatContext<T>
,RetryContext<T>
-
Constructor Summary
ConstructorDescriptionDefaultContext
(T applicationContext, long iteration, BackoffDelay backoff, long repeatCompanionValue) DefaultContext
(T applicationContext, long iteration, BackoffDelay backoff, Throwable exception) -
Method Summary
-
Constructor Details
-
DefaultContext
public DefaultContext(T applicationContext, long iteration, BackoffDelay backoff, long repeatCompanionValue) -
DefaultContext
public DefaultContext(T applicationContext, long iteration, BackoffDelay backoff, Throwable exception)
-
-
Method Details
-
applicationContext
Description copied from interface:IterationContext
Application context that may be used to perform any rollbacks before a retry. Application context can be configured usingRetry.withApplicationContext(Object)
orRepeat.withApplicationContext(Object)
.- Specified by:
applicationContext
in interfaceIterationContext<T>
- Returns:
- application context
-
iteration
public long iteration()Description copied from interface:IterationContext
The next iteration number. This is a zero-based incrementing number with the first attempt prior to any retries as iteration zero.- Specified by:
iteration
in interfaceIterationContext<T>
- Returns:
- the current iteration number
-
companionValue
Description copied from interface:RepeatContext
Returns the value provided in the companion Flux for repeats.- For
Flux.repeatWhen(java.util.function.Function)
andMono.repeatWhen(java.util.function.Function)
, value is the number of items emitted in the last attempt. - For
Mono.repeatWhenEmpty(java.util.function.Function)
andMono.repeatWhenEmpty(int, java.util.function.Function)
, value is a zero-based incrementing Long, which is number of attempts - 1.
- Specified by:
companionValue
in interfaceRepeatContext<T>
- Returns:
- value the value emitted on the companion Flux for repeats.
- For
-
exception
Description copied from interface:RetryContext
Returns the exception from the last iteration.- Specified by:
exception
in interfaceRetryContext<T>
- Returns:
- exception that resulted in retry
-
backoff
Description copied from interface:IterationContext
The backoff delay. WhenBackoff
function is invoked, the previous backoff is provided in the context. The context provided for the retry predicatesRetry.onlyIf(java.util.function.Predicate)
andRepeat.onlyIf(java.util.function.Predicate)
as well as the retry callbacksRetry.doOnRetry(java.util.function.Consumer)
andRepeat.doOnRepeat(java.util.function.Consumer)
provide the backoff delay for the next retry.- Specified by:
backoff
in interfaceIterationContext<T>
- Returns:
- Backoff delay
-
toString
-