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:
AsyncTimeout,BulkheadBase,CircuitBreaker,CompletionStageCircuitBreaker,CompletionStageExecution,CompletionStageFallback,CompletionStageMetricsCollector,CompletionStageRetry,CompletionStageThreadPoolBulkhead,CompletionStageTimeout,Fallback,FutureExecution,FutureThreadPoolBulkhead,Invocation,MetricsCollector,RememberEventLoop,Retry,SemaphoreBulkhead,Timeout
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface FaultToleranceStrategy<V>
A fault tolerance strategy that guards invocations of arbitraryCallables. Fault tolerance strategies are expected to be nested; that is, implementations of this interface will typically delegate to some otherFaultToleranceStrategy. The last strategy in the chain will invoke the guardedCallable; all other strategies are supposed to ignore it and just pass it down the chain. Usually, the last strategy will beInvocation.The
Callables are wrapped in anInvocationContext, 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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Vapply(InvocationContext<V> ctx)Apply the fault tolerance strategy around the targetCallable.
-
-
-
Method Detail
-
apply
V apply(InvocationContext<V> ctx) throws Exception
Apply the fault tolerance strategy around the targetCallable. TheCallableis wrapped in anInvocationContext.- Parameters:
ctx- theInvocationContextwrapping theCallableguarded by this fault tolerance strategy- Returns:
- result computed by the target
Callable - Throws:
Exception- if result couldn't be computed
-
-