S - self typeR - result typepublic abstract class FailurePolicy<S,R> extends PolicyListeners<S,R> implements Policy<R>
handle conditions. The default exception handling condition will only be overridden by
another condition that handles failure exceptions such as handle(Class) or handleIf(BiPredicate).
Specifying a condition that only handles results, such as handleResult(Object) or
handleResultIf(Predicate) 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.| 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, onSuccessclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waittoExecutorpublic 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 © 2021. All rights reserved.