Class FutureThreadPoolBulkhead<V>
- java.lang.Object
-
- io.smallrye.faulttolerance.core.bulkhead.BulkheadBase<Future<V>>
-
- io.smallrye.faulttolerance.core.bulkhead.FutureThreadPoolBulkhead<V>
-
- All Implemented Interfaces:
FaultToleranceStrategy<Future<V>>
public class FutureThreadPoolBulkhead<V> extends BulkheadBase<Future<V>>
Thread pool style bulkhead forFutureasynchronous executions.Since this bulkhead is already executed on an extra thread, we don't have to submit tasks to another executor or use an actual queue. We just limit the task execution by semaphores. This kinda defeats the purpose of bulkheads, but is the easiest way to implement them for
Future. We do it properly forCompletionStage, which is much more useful anyway.
-
-
Field Summary
-
Fields inherited from class io.smallrye.faulttolerance.core.bulkhead.BulkheadBase
description
-
-
Constructor Summary
Constructors Constructor Description FutureThreadPoolBulkhead(FaultToleranceStrategy<Future<V>> delegate, String description, int size, int queueSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Future<V>apply(InvocationContext<Future<V>> ctx)Apply the fault tolerance strategy around the targetCallable.
-
-
-
Constructor Detail
-
FutureThreadPoolBulkhead
public FutureThreadPoolBulkhead(FaultToleranceStrategy<Future<V>> delegate, String description, int size, int queueSize)
-
-
Method Detail
-
apply
public Future<V> apply(InvocationContext<Future<V>> ctx) throws Exception
Description copied from interface:FaultToleranceStrategyApply 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
-
-