Class AsyncTimeout<V>
- java.lang.Object
-
- io.smallrye.faulttolerance.core.timeout.AsyncTimeout<V>
-
- All Implemented Interfaces:
FaultToleranceStrategy<Future<V>>
public class AsyncTimeout<V> extends Object implements FaultToleranceStrategy<Future<V>>
The next strategy in the chain must beTimeout, and it is invoked on an extra thread. Communication then happens usingAsyncTimeoutNotification.Note that the
TimeoutExceptionthrown from this strategy might come from two places: theTimeoutstrategy throwing, orAsyncTimeoutTask#timedOutsetting an exception as a result ofAsyncTimeoutNotification. Both might happen, and whichever happens first gets to decide.
-
-
Constructor Summary
Constructors Constructor Description AsyncTimeout(Timeout<Future<V>> delegate, Executor executor)
-
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.
-
-
-
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.- Specified by:
applyin interfaceFaultToleranceStrategy<V>- Parameters:
ctx- theInvocationContextwrapping theCallableguarded by this fault tolerance strategy- Returns:
- result computed by the target
Callable - Throws:
Exception- if result couldn't be computed
-
-