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:
-
Method Summary
Modifier and TypeMethodDescriptiondone()Returns the original fault tolerance builder.duration(long value, ChronoUnit unit) Sets the timeout duration.onFinished(Runnable callback) Sets a callback that will be invoked when an invocation finishes before the timeout.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 Details
-
duration
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:
-
onTimeout
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
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)
-