Interface FaultToleranceStrategy<V>

Type Parameters:
V - the result type of method apply; also the result type of the guarded Callable
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.

@FunctionalInterface public interface FaultToleranceStrategy<V>
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 Details

    • apply

      Apply the fault tolerance strategy around the target Callable. The Callable is wrapped in an FaultToleranceContext.
      Parameters:
      ctx - the InvocationContext wrapping the Callable guarded by this fault tolerance strategy
      Returns:
      result computed by the target Callable