S
- self typeR
- result typepublic abstract class FailurePolicy<S,R> extends PolicyListeners<S,R> implements Policy<R>
If no handlers are configured, the execution is considered a failure if an Exception was thrown.
Modifier and Type | Method and Description |
---|---|
S |
handle(Class<? extends Throwable>... failures)
Specifies the failures to handle.
|
S |
handle(Class<? extends Throwable> failure)
Specifies the failure to handle.
|
S |
handle(List<Class<? extends Throwable>> failures)
Specifies the failures to handle.
|
S |
handleIf(BiPredicate<R,? extends Throwable> resultPredicate)
Specifies that a failure has occurred if the
resultPredicate matches the execution result. |
S |
handleIf(Predicate<? extends Throwable> failurePredicate)
Specifies that a failure has occurred if the
failurePredicate matches the failure. |
S |
handleResult(R result)
Specifies that a failure has occurred if the
result matches the execution result. |
S |
handleResultIf(Predicate<R> resultPredicate)
Specifies that a failure has occurred if the
resultPredicate matches the execution result. |
boolean |
isFailure(R result,
Throwable failure)
Returns whether an execution result can be retried given the configured failure conditions.
|
onFailure, onSuccess
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
toExecutor
public S handle(Class<? extends Throwable> failure)
failure
will be handled.NullPointerException
- if failure
is null@SafeVarargs public final S handle(Class<? extends Throwable>... failures)
failures
will be handled.NullPointerException
- if failures
is nullIllegalArgumentException
- if failures is emptypublic S handle(List<Class<? extends Throwable>> failures)
failures
will be handled.NullPointerException
- if failures
is nullIllegalArgumentException
- if failures is null or emptypublic S handleIf(Predicate<? extends Throwable> failurePredicate)
failurePredicate
matches the failure.NullPointerException
- if failurePredicate
is nullpublic S handleIf(BiPredicate<R,? extends Throwable> resultPredicate)
resultPredicate
matches the execution result.NullPointerException
- if resultPredicate
is nullpublic S handleResult(R result)
result
matches the execution result.public S handleResultIf(Predicate<R> resultPredicate)
resultPredicate
matches the execution result.NullPointerException
- if resultPredicate
is nullpublic boolean isFailure(R result, Throwable failure)
handle(Class...)
,
handle(List)
,
handleIf(BiPredicate)
,
handleIf(Predicate)
,
#handleResult(R)
,
handleResultIf(Predicate)
Copyright © 2020. All rights reserved.