R
- result typepublic class FallbackBuilder<R> extends FailurePolicyBuilder<FallbackBuilder<R>,FallbackConfig<R>,R> implements PolicyListeners<FallbackBuilder<R>,R>
Fallback
instances.
handle
conditions. The default exception handling condition will only be overridden by
another condition that handles failure exceptions such as FailurePolicyBuilder.handle(Class)
or FailurePolicyBuilder.handleIf(CheckedBiPredicate)
.
Specifying a condition that only handles results, such as FailurePolicyBuilder.handleResult(Object)
or
FailurePolicyBuilder.handleResultIf(CheckedPredicate)
will not replace the default exception handling condition.handle
conditions are specified, any condition that matches an execution result or failure
will trigger policy handling.Note:
FailurePolicyBuilder
which offers additional configuration.FallbackConfig
config
Modifier and Type | Method and Description |
---|---|
Fallback<R> |
build()
Builds a new
Fallback using the builder's configuration. |
FallbackBuilder<R> |
onFailedAttempt(EventListener<ExecutionAttemptedEvent<R>> listener)
Registers the
listener to be called when the last execution attempt prior to the fallback failed. |
FallbackBuilder<R> |
withAsync()
Configures the fallback to run asynchronously.
|
handle, handle, handle, handleIf, handleIf, handleResult, handleResultIf
onFailure, onSuccess
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
onFailure, onSuccess
public FallbackBuilder<R> onFailedAttempt(EventListener<ExecutionAttemptedEvent<R>> listener)
listener
to be called when the last execution attempt prior to the fallback failed. You can
also use onFailure
to determine when the fallback attempt also fails.
Note: Any exceptions that are thrown from within the listener
are ignored.
NullPointerException
- if listener
is nullpublic FallbackBuilder<R> withAsync()
Copyright © 2022. All rights reserved.