public interface FailurePolicy<T> extends java.util.function.Predicate<Future<T>>
CircuitBreaker.
The default policy is to consider an asynchronous result as a failure if AsyncResult.failed() returns true.
Nevertheless, sometimes this is not good enough. For example, an HTTP Client could return a response, but with an unexpected status code.
In this case, a custom failure policy can be configured with CircuitBreaker.failurePolicy(FailurePolicy).
| Modifier and Type | Method and Description |
|---|---|
static <U> FailurePolicy<U> |
defaultPolicy()
The default policy, which considers an asynchronous result as a failure if
AsyncResult.failed() returns true. |
boolean |
test(Future<T> future)
Invoked by the
CircuitBreaker when an operation completes. |
and, isEqual, negate, orstatic <U> FailurePolicy<U> defaultPolicy()
AsyncResult.failed() returns true.boolean test(Future<T> future)
CircuitBreaker when an operation completes.test in interface java.util.function.Predicate<Future<T>>future - a completed futuretrue if the asynchronous result should be considered as a failure, false otherwiseCopyright © 2024 Eclipse. All rights reserved.