public class DefaultContext<T> extends 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,
Throwable exception) |
Modifier and Type | Method and Description |
---|---|
T |
applicationContext()
Application context that may be used to perform any rollbacks before
a retry.
|
Duration |
backoff()
The backoff delay.
|
Long |
companionValue()
Returns the value provided in the companion Flux for repeats.
|
Throwable |
exception()
Returns the exception from the last iteration.
|
long |
iteration()
The next iteration number.
|
String |
toString() |
public DefaultContext(T applicationContext, long iteration, BackoffDelay backoff, long repeatCompanionValue)
public DefaultContext(T applicationContext, long iteration, BackoffDelay backoff, Throwable exception)
public T applicationContext()
IterationContext
Retry.withApplicationContext(Object)
or Repeat.withApplicationContext(Object)
.applicationContext
in interface IterationContext<T>
public long iteration()
IterationContext
iteration
in interface IterationContext<T>
public Long companionValue()
RepeatContext
Flux.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 Throwable exception()
RetryContext
exception
in interface RetryContext<T>
public Duration backoff()
IterationContext
Backoff
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.backoff
in interface IterationContext<T>