V - the result type of method apply; also the result type of the guarded Callable@FunctionalInterface public interface FaultToleranceStrategy<V>
Callables.
Fault tolerance strategies are expected to be nested; that is, implementations of this interface will typically delegate to
some other FaultToleranceStrategy.
The last strategy in the chain will invoke the guarded Callable; all other strategies are supposed to ignore it and
just pass it down the chain.
Usually, the last strategy will be Invocation.
The Callables are wrapped in an InvocationContext, which also provides support for out-of-band
communication between fault tolerance strategies in a single chain.
The strategies must be thread-safe, as they are expected to be used simultaneously from multiple threads. This is important in case of strategies that maintain some state over time (such as circuit breaker).
| Modifier and Type | Method and Description |
|---|---|
V |
apply(InvocationContext<V> ctx)
Apply the fault tolerance strategy around the target
Callable. |
V apply(InvocationContext<V> ctx) throws Exception
Callable.
The Callable is wrapped in an InvocationContext.ctx - the InvocationContext wrapping the Callable guarded by this fault tolerance strategyCallableException - if result couldn't be computedCopyright © 2018–2020. All rights reserved.