public class UniOnTimeout<T> extends Object
| Constructor and Description |
|---|
UniOnTimeout(Uni<T> upstream,
Duration timeout,
ScheduledExecutorService executor) |
| Modifier and Type | Method and Description |
|---|---|
UniOnTimeout<T> |
after(Duration timeout)
Configures the timeout duration.
|
Uni<T> |
fail() |
Uni<T> |
failWith(Supplier<? extends Throwable> supplier) |
Uni<T> |
failWith(Throwable failure) |
UniOnTimeout<T> |
on(ScheduledExecutorService executor)
Configures on which executor the timeout is measured.
|
Uni<T> |
recoverWithItem(Supplier<T> supplier)
|
Uni<T> |
recoverWithItem(T fallback)
|
Uni<T> |
recoverWithUni(Supplier<? extends Uni<? extends T>> supplier)
|
Uni<T> |
recoverWithUni(Uni<? extends T> fallback)
|
public UniOnTimeout(Uni<T> upstream, Duration timeout, ScheduledExecutorService executor)
public UniOnTimeout<T> after(Duration timeout)
timeout - the timeout, must not be null, must be strictly positive.UniOnTimeoutpublic UniOnTimeout<T> on(ScheduledExecutorService executor)
Timeout failure event.executor - the executor to use, must not be nullUniOnTimeoutpublic Uni<T> recoverWithItem(T fallback)
Uni firing a fallback item when the current Uni the upstream Uni do not
emit an item before the timeout.
The fallback item (potentially null) is used as item by the produced Uni.
fallback - the fallback value, may be nullUnipublic Uni<T> recoverWithItem(Supplier<T> supplier)
Uni firing a fallback item supplied by the given supplier when the current Uni
times out. The produced item (potentially null) is fired as item by the produced Uni.
Note that if the supplier throws an exception, the produced Uni emits a failure.supplier - the fallback supplier, may be nullUnipublic Uni<T> recoverWithUni(Supplier<? extends Uni<? extends T>> supplier)
Uni providing a fallback Uni when the current Uni times out. The fallback
is produced using the given supplier, and it called when the failure is caught. The produced Uni is used
instead of the current Uni.supplier - the fallback supplier, must not be null, must not produce nullUniCopyright © 2019–2020 SmallRye. All rights reserved.