Package io.smallrye.faulttolerance.core
Interface FaultToleranceStrategy<V>
- Type Parameters:
V- the result type of methodapply; also the result type of the guardedCallable
- All Known Implementing Classes:
Bulkhead,CircuitBreaker,DelegatingMetricsCollector,Fallback,FutureExecution,FutureTimeout,Invocation,MetricsCollector,RateLimit,RememberEventLoop,Retry,SyncAsyncSplit,ThreadOffload,Timeout
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
A fault tolerance strategy that guards invocations of arbitrary
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 FaultToleranceContext, 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).
-
Method Summary
-
Method Details
-
apply
Apply the fault tolerance strategy around the targetCallable. TheCallableis wrapped in anFaultToleranceContext.- Parameters:
ctx- theInvocationContextwrapping theCallableguarded by this fault tolerance strategy- Returns:
- result computed by the target
Callable
-