Package io.smallrye.faulttolerance.api
Interface FaultTolerance.Builder.TimeoutBuilder<T,R>
-
- Enclosing interface:
- FaultTolerance.Builder<T,R>
public static interface FaultTolerance.Builder.TimeoutBuilder<T,R>Configures a timeout.- See Also:
@Timeout
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description FaultTolerance.Builder<T,R>done()Returns the original fault tolerance builder.FaultTolerance.Builder.TimeoutBuilder<T,R>duration(long value, ChronoUnit unit)Sets the timeout duration.FaultTolerance.Builder.TimeoutBuilder<T,R>onFinished(Runnable callback)Sets a callback that will be invoked when an invocation finishes before the timeout.FaultTolerance.Builder.TimeoutBuilder<T,R>onTimeout(Runnable callback)Sets a callback that will be invoked when an invocation times out.default FaultTolerance.Builder.TimeoutBuilder<T,R>with(Consumer<FaultTolerance.Builder.TimeoutBuilder<T,R>> consumer)
-
-
-
Method Detail
-
duration
FaultTolerance.Builder.TimeoutBuilder<T,R> duration(long value, ChronoUnit unit)
Sets the timeout duration. Defaults to 1 second.- Parameters:
value- the timeout length, must be >= 0unit- the timeout unit, must not benull- Returns:
- this timeout builder
- See Also:
@Timeout.value,@Timeout.unit
-
onTimeout
FaultTolerance.Builder.TimeoutBuilder<T,R> onTimeout(Runnable callback)
Sets a callback that will be invoked when an invocation times out.The callback must be fast and non-blocking and must not throw an exception.
- Parameters:
callback- the timeout callback, must not benull- Returns:
- this timeout builder
-
onFinished
FaultTolerance.Builder.TimeoutBuilder<T,R> onFinished(Runnable callback)
Sets a callback that will be invoked when an invocation finishes before the timeout.The callback must be fast and non-blocking and must not throw an exception.
- Parameters:
callback- the finished callback, must not benull- Returns:
- this timeout builder
-
done
FaultTolerance.Builder<T,R> done()
Returns the original fault tolerance builder.- Returns:
- the original fault tolerance builder
-
with
default FaultTolerance.Builder.TimeoutBuilder<T,R> with(Consumer<FaultTolerance.Builder.TimeoutBuilder<T,R>> consumer)
-
-