T - the type of the itempublic class UniAwaitOptional<T> extends Object
UniAwait but wrapping the item event into an Optional. This optional is empty if the
Uni fires null.Uni.await()| Constructor and Description |
|---|
UniAwaitOptional(Uni<T> upstream) |
| Modifier and Type | Method and Description |
|---|---|
Optional<T> |
atMost(Duration duration)
Subscribes to the
Uni and waits (blocking the caller thread) at most the given duration
until an item or failure is fired by the upstream uni. |
Optional<T> |
indefinitely()
Subscribes to the
Uni and waits (blocking the caller thread) indefinitely until a
item event is fired or a failure event is fired by the upstream uni. |
public Optional<T> indefinitely()
Uni and waits (blocking the caller thread) indefinitely until a
item event is fired or a failure event is fired by the upstream uni.
If the Uni fires an item, it returns that item wrapped into an Optional. If the item is
null the returned optional is empty.
If the Uni fires a failure, the original exception is thrown (wrapped in
a CompletionException it's a checked exception).
Note that each call to this method triggers a new subscription.
public Optional<T> atMost(Duration duration)
Uni and waits (blocking the caller thread) at most the given duration
until an item or failure is fired by the upstream uni.
If the Uni fires an item, it returns that item wrapped into an Optional. If the item is
null the returned optional is empty.
If the Uni fires a failure, the original exception is thrown (wrapped in
a CompletionException it's a checked exception).
If the timeout is reached before completion, a TimeoutException is thrown.
Note that each call to this method triggers a new subscription.
duration - the duration, must not be null, must not be negative or zero.Uni, potentially nullCopyright © 2019–2020 SmallRye. All rights reserved.