R
- result typepublic interface Fallback<R> extends Policy<R>
This class is threadsafe.
TimeoutConfig
,
FallbackBuilder
Modifier and Type | Method and Description |
---|---|
static <R> FallbackBuilder<R> |
builder(CheckedConsumer<ExecutionAttemptedEvent<? extends R>> fallback)
Returns the
fallback to be executed if execution fails. |
static <R> FallbackBuilder<R> |
builder(CheckedFunction<ExecutionAttemptedEvent<? extends R>,? extends R> fallback)
Returns the
fallback to be executed if execution fails. |
static <R> FallbackBuilder<R> |
builder(CheckedRunnable fallback)
Returns the
fallback to be executed if execution fails. |
static <R> FallbackBuilder<R> |
builder(CheckedSupplier<? extends R> fallback)
Returns the
fallback to be executed if execution fails. |
static <R> FallbackBuilder<R> |
builder(FallbackConfig<R> config)
Creates a new FallbackBuilder that will be based on the
config . |
static <R> FallbackBuilder<R> |
builder(R fallbackResult)
Returns the
fallbackResult to be provided if execution fails. |
static <R> FallbackBuilder<R> |
builderOfException(CheckedFunction<ExecutionAttemptedEvent<? extends R>,? extends Exception> fallback)
Returns the
fallback to be executed if execution fails and allows an alternative exception to be supplied
instead. |
static <R> FallbackBuilder<R> |
builderOfStage(CheckedFunction<ExecutionAttemptedEvent<? extends R>,? extends CompletionStage<R>> fallback)
Returns the
fallback to be executed if execution fails. |
static <R> FallbackBuilder<R> |
builderOfStage(CheckedSupplier<? extends CompletionStage<R>> fallback)
Returns the
fallback to be executed if execution fails. |
FallbackConfig<R> |
getConfig()
Returns the
FallbackConfig that the Fallback was built with. |
static Fallback<Void> |
none()
Returns a fallback that will return a null if execution fails.
|
static <R> Fallback<R> |
of(CheckedConsumer<ExecutionAttemptedEvent<? extends R>> fallback)
Returns the
fallback to be executed if execution fails. |
static <R> Fallback<R> |
of(CheckedFunction<ExecutionAttemptedEvent<? extends R>,? extends R> fallback)
Returns the
fallback to be executed if execution fails. |
static <R> Fallback<R> |
of(CheckedRunnable fallback)
Returns the
fallback to be executed if execution fails. |
static <R> Fallback<R> |
of(CheckedSupplier<? extends R> fallback)
Returns the
fallback to be executed if execution fails. |
static <R> Fallback<R> |
of(R fallbackResult)
Returns the
fallbackResult to be provided if execution fails. |
static <R> Fallback<R> |
ofException(CheckedFunction<ExecutionAttemptedEvent<? extends R>,? extends Exception> fallback)
Returns the
fallback to be executed if execution fails and allows an alternative exception to be supplied
instead. |
static <R> Fallback<R> |
ofStage(CheckedFunction<ExecutionAttemptedEvent<? extends R>,? extends CompletionStage<R>> fallback)
Returns the
fallback to be executed if execution fails. |
static <R> Fallback<R> |
ofStage(CheckedSupplier<? extends CompletionStage<R>> fallback)
Returns the
fallback to be executed if execution fails. |
toExecutor
static <R> FallbackBuilder<R> builder(FallbackConfig<R> config)
config
.static <R> FallbackBuilder<R> builder(CheckedRunnable fallback)
fallback
to be executed if execution fails.NullPointerException
- if fallback
is nullstatic <R> FallbackBuilder<R> builder(CheckedSupplier<? extends R> fallback)
fallback
to be executed if execution fails.NullPointerException
- if fallback
is nullstatic <R> FallbackBuilder<R> builder(CheckedConsumer<ExecutionAttemptedEvent<? extends R>> fallback)
fallback
to be executed if execution fails. The fallback
accepts an ExecutionAttemptedEvent
.NullPointerException
- if fallback
is nullstatic <R> FallbackBuilder<R> builder(CheckedFunction<ExecutionAttemptedEvent<? extends R>,? extends R> fallback)
fallback
to be executed if execution fails. The fallback
applies an ExecutionAttemptedEvent
.NullPointerException
- if fallback
is nullstatic <R> FallbackBuilder<R> builder(R fallbackResult)
fallbackResult
to be provided if execution fails.static <R> FallbackBuilder<R> builderOfException(CheckedFunction<ExecutionAttemptedEvent<? extends R>,? extends Exception> fallback)
fallback
to be executed if execution fails and allows an alternative exception to be supplied
instead. The fallback
applies an ExecutionAttemptedEvent
and must return an exception.NullPointerException
- if fallback
is nullstatic <R> FallbackBuilder<R> builderOfStage(CheckedSupplier<? extends CompletionStage<R>> fallback)
fallback
to be executed if execution fails.NullPointerException
- if fallback
is nullstatic <R> FallbackBuilder<R> builderOfStage(CheckedFunction<ExecutionAttemptedEvent<? extends R>,? extends CompletionStage<R>> fallback)
fallback
to be executed if execution fails. The fallback
accepts an ExecutionAttemptedEvent
.NullPointerException
- if fallback
is nullstatic <R> Fallback<R> of(CheckedRunnable fallback)
fallback
to be executed if execution fails.NullPointerException
- if fallback
is nullstatic <R> Fallback<R> of(CheckedSupplier<? extends R> fallback)
fallback
to be executed if execution fails.NullPointerException
- if fallback
is nullstatic <R> Fallback<R> of(CheckedConsumer<ExecutionAttemptedEvent<? extends R>> fallback)
fallback
to be executed if execution fails. The fallback
accepts an ExecutionAttemptedEvent
.NullPointerException
- if fallback
is nullstatic <R> Fallback<R> of(CheckedFunction<ExecutionAttemptedEvent<? extends R>,? extends R> fallback)
fallback
to be executed if execution fails. The fallback
applies an ExecutionAttemptedEvent
.NullPointerException
- if fallback
is nullstatic <R> Fallback<R> ofException(CheckedFunction<ExecutionAttemptedEvent<? extends R>,? extends Exception> fallback)
fallback
to be executed if execution fails and allows an alternative exception to be supplied
instead. The fallback
applies an ExecutionAttemptedEvent
and must return an exception.NullPointerException
- if fallback
is nullstatic <R> Fallback<R> of(R fallbackResult)
fallbackResult
to be provided if execution fails.static <R> Fallback<R> ofStage(CheckedSupplier<? extends CompletionStage<R>> fallback)
fallback
to be executed if execution fails.NullPointerException
- if fallback
is nullstatic <R> Fallback<R> ofStage(CheckedFunction<ExecutionAttemptedEvent<? extends R>,? extends CompletionStage<R>> fallback)
fallback
to be executed if execution fails. The fallback
accepts an ExecutionAttemptedEvent
.NullPointerException
- if fallback
is nullFallbackConfig<R> getConfig()
FallbackConfig
that the Fallback was built with.Copyright © 2022. All rights reserved.