Class Bulkhead<V>
java.lang.Object
io.smallrye.faulttolerance.core.bulkhead.Bulkhead<V>
- All Implemented Interfaces:
FaultToleranceStrategy<V>
Unified bulkhead that behaves in a semaphore fashion for synchronous executions
and in a thread pool fashion for asynchronous executions.
Implements a proper queue of tasks for async executions. When an async task (that was previously allowed to enter) leaves the bulkhead, it will attempt to take one task from the queue and execute it.
It also allows synchronous queueing, which is an implementation of a thread pool bulkhead for pseudo-asynchronous invocations. Those are already offloaded to an extra thread and so don't require proper queueing, just two semaphores.
-
Constructor Summary
ConstructorsConstructorDescriptionBulkhead(FaultToleranceStrategy<V> delegate, String description, int size, int queueSize, boolean syncQueueing) -
Method Summary
-
Constructor Details
-
Bulkhead
public Bulkhead(FaultToleranceStrategy<V> delegate, String description, int size, int queueSize, boolean syncQueueing)
-
-
Method Details
-
apply
Description copied from interface:FaultToleranceStrategyApply the fault tolerance strategy around the targetCallable. TheCallableis wrapped in anFaultToleranceContext.- Specified by:
applyin interfaceFaultToleranceStrategy<V>- Parameters:
ctx- theInvocationContextwrapping theCallableguarded by this fault tolerance strategy- Returns:
- result computed by the target
Callable
-