Package io.smallrye.faulttolerance.api
Interface TypedGuard.Builder.TimeoutBuilder<T>
- Enclosing interface:
TypedGuard.Builder<T>
public static interface TypedGuard.Builder.TimeoutBuilder<T>
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 TypedGuard.Builder.TimeoutBuilder<T> with(Consumer<TypedGuard.Builder.TimeoutBuilder<T>> 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
TypedGuard.Builder<T> done()Returns the original fault tolerance builder.- Returns:
- the original fault tolerance builder
-
with
default TypedGuard.Builder.TimeoutBuilder<T> with(Consumer<TypedGuard.Builder.TimeoutBuilder<T>> consumer)
-