public class DefaultContext<T> extends java.lang.Object implements RetryContext<T>, RepeatContext<T>
| Constructor and Description |
|---|
DefaultContext(T applicationContext,
long iteration,
BackoffDelay backoff,
long repeatCompanionValue) |
DefaultContext(T applicationContext,
long iteration,
BackoffDelay backoff,
java.lang.Throwable exception) |
| Modifier and Type | Method and Description |
|---|---|
T |
applicationContext()
Application context that may be used to perform any rollbacks before
a retry.
|
java.time.Duration |
backoff()
The backoff delay.
|
java.lang.Long |
companionValue()
Returns the value provided in the companion Flux for repeats.
|
java.lang.Throwable |
exception()
Returns the exception from the last iteration.
|
long |
iteration()
The next iteration number.
|
java.lang.String |
toString() |
public DefaultContext(T applicationContext, long iteration, BackoffDelay backoff, long repeatCompanionValue)
public DefaultContext(T applicationContext, long iteration, BackoffDelay backoff, java.lang.Throwable exception)
public T applicationContext()
ContextRetry.withApplicationContext(Object)
or Repeat.withApplicationContext(Object).applicationContext in interface Context<T>public long iteration()
Contextpublic java.lang.Long companionValue()
RepeatContextFlux.repeatWhen(java.util.function.Function) and Mono.repeatWhen(java.util.function.Function),
value is the number of items emitted in the last attempt.
Mono.repeatWhenEmpty(java.util.function.Function) and Mono.repeatWhenEmpty(int, java.util.function.Function),
value is a zero-based incrementing Long, which is number of attempts - 1.
companionValue in interface RepeatContext<T>public java.lang.Throwable exception()
RetryContextexception in interface RetryContext<T>public java.time.Duration backoff()
ContextBackoff function is invoked, the previous
backoff is provided in the context. The context provided for the retry
predicates Retry.onlyIf(java.util.function.Predicate) and
Repeat.onlyIf(java.util.function.Predicate) as well as the retry
callbacks Retry.doOnRetry(java.util.function.Consumer) and
Repeat.doOnRepeat(java.util.function.Consumer) provide the
backoff delay for the next retry.public java.lang.String toString()
toString in class java.lang.Object