- Type Parameters:
T- item type
- All Superinterfaces:
Awaitable<T>,CompletionStage<T>,Flow.Publisher<T>,Subscribable<T>
- All Known Implementing Classes:
CompletionSingle
Flow.Publisher that may: signal one item then completes, complete without
an item or signal an error.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionacceptEither(CompletionStage<? extends T> other, Consumer<? super T> action) acceptEitherAsync(CompletionStage<? extends T> other, Consumer<? super T> action) acceptEitherAsync(CompletionStage<? extends T> other, Consumer<? super T> action, Executor executor) <U> CompletionAwaitable<U>applyToEither(CompletionStage<? extends T> other, Function<? super T, U> fn) <U> CompletionAwaitable<U>applyToEitherAsync(CompletionStage<? extends T> other, Function<? super T, U> fn) <U> CompletionAwaitable<U>applyToEitherAsync(CompletionStage<? extends T> other, Function<? super T, U> fn, Executor executor) cancel()Cancel upstream.default <U> Single<U>Apply the givencomposerfunction to the currentSingleinstance and return theSinglereturned by this function.static <T> Single<T>static <T> Single<T>create(CompletionStage<T> completionStage) Wrap a CompletionStage into a Multi and signal its outcome non-blockingly.static <T> Single<T>create(CompletionStage<T> completionStage, boolean nullMeansEmpty) Wrap a CompletionStage into a Multi and signal its outcome non-blockingly.static <T> Single<T>create(Flow.Publisher<T> source) Create aSingleinstance that publishes the first and only item received from the given publisher.static <T> Single<T>Create aSingleinstance that publishes result of the given supplier to its subscriber(s).defaultIfEmpty(Supplier<? extends T> supplier) Signals the default item supplied by specified supplier if the upstream is empty.defaultIfEmpty(T defaultItem) Signals the default item if the upstream is empty.static <T> Single<T>Call the given supplier function for each individual downstream Subscriber to return a Flow.Publisher to subscribe to.static <T> Single<T>empty()Get aSingleinstance that completes immediately.static <T> Single<T>Create aSingleinstance that reports the given given exception to its subscriber(s).exceptionally(Function<Throwable, ? extends T> fn) exceptionallyAccept(Consumer<Throwable> consumer) Returns a new CompletionAwaitable that, when this stage completes exceptionally, is executed with this stage's exception as the argument to the supplied consumer.default <U> Multi<U>flatMap(Function<? super T, ? extends Flow.Publisher<? extends U>> mapper) default <U> Single<U>flatMapCompletionStage(Function<? super T, ? extends CompletionStage<? extends U>> mapper) Transforms item with supplied function and flatten resultingCompletionStageresult to downstream.default <U> Multi<U>flatMapIterable(Function<? super T, ? extends Iterable<? extends U>> mapper) Maps the single upstream value into anIterableand relays its items to the downstream.default <U> Single<U>flatMapOptional(Function<? super T, Optional<? extends U>> mapper) Transform item with supplied function and flatten resultingOptionalto downstream as Single with its value as item if present or empty Single.default <U> Single<U>flatMapSingle(Function<? super T, ? extends Single<? extends U>> mapper) Transforms item with supplied function and flatten resultingSingleto downstream.default CompletionAwaitable<Void>Terminal stage, invokes provided consumer when Single is completed.static <T> Single<T>Deprecated.static <T> Single<T>from(CompletionStage<T> completionStage) Deprecated.usecreate(java.util.concurrent.CompletionStage)insteadstatic <T> Single<T>from(CompletionStage<T> completionStage, boolean nullMeansEmpty) Deprecated.static <T> Single<T>from(Flow.Publisher<T> source) Deprecated.usecreate(java.util.concurrent.Flow.Publisher)insteaddefault Tget()Short-hand fortoFuture().toCompletableFuture().get().default TShort-hand fortoFuture().toCompletableFuture().get().<U> CompletionAwaitable<U>handle(BiFunction<? super T, Throwable, ? extends U> fn) <U> CompletionAwaitable<U>handleAsync(BiFunction<? super T, Throwable, ? extends U> fn) <U> CompletionAwaitable<U>handleAsync(BiFunction<? super T, Throwable, ? extends U> fn, Executor executor) Executes givenRunnablewhen stream is finished without value(empty stream).default CompletionAwaitable<Void>Terminal stage, ignore onNext signals, only onComplete and onError signals are propagated.static <T> Single<T>just(T item) Create aSingleinstance that publishes the given item to its subscriber(s).log()Log all signalsonSubscribe,onNext,onError,onComplete,cancelandrequestcoming to and from preceding operator.Log all signalsonSubscribe,onNext,onError,onComplete,cancelandrequestcoming to and from preceding operator.Log all signalsonSubscribe,onNext,onError,onComplete,cancelandrequestcoming to and from preceding operator.Log all signalsonSubscribe,onNext,onError,onComplete,cancelandrequestcoming to and from preceding operator.default <U> Single<U>static <T> Single<T>never()Get aSingleinstance that never completes.Re-emit the upstream's signals to the downstream on the given executor's thread.Executes givenRunnablewhen a cancel signal is received.onComplete(Runnable onComplete) Executes givenRunnablewhen onComplete signal is received.onCompleteResume(T item) Resume stream from single item if onComplete signal is intercepted.onCompleteResumeWith(Flow.Publisher<? extends T> publisher) Resume stream from supplied publisher if onComplete signal is intercepted.Resume stream with supplied single if onComplete signal is intercepted.Executes givenConsumerwhen onError signal is received.onErrorResume(Function<? super Throwable, ? extends T> onError) Functionproviding one item to be submitted as onNext in case of onError signal is received.onErrorResumeWith(Function<? super Throwable, ? extends Flow.Publisher<? extends T>> onError) Resume stream from supplied publisher if onError signal is intercepted.onErrorResumeWithSingle(Function<? super Throwable, ? extends Single<? extends T>> onError) Resume stream from supplied publisher if onError signal is intercepted.onTerminate(Runnable onTerminate) Executes givenRunnablewhen any of signals onComplete, onCancel or onError is received.Invoke provided consumer for the item in stream.retry(long count) Retry a failing upstream at most the given number of times before giving up.retry(BiPredicate<? super Throwable, ? super Long> predicate) Retry a failing upstream if the predicate returns true.retryWhen(BiFunction<? super Throwable, ? super Long, ? extends Flow.Publisher<U>> whenFunction) Retry a failing upstream when the given function returns a publisher that signals an item.runAfterBoth(CompletionStage<?> other, Runnable action) runAfterBothAsync(CompletionStage<?> other, Runnable action) runAfterBothAsync(CompletionStage<?> other, Runnable action, Executor executor) runAfterEither(CompletionStage<?> other, Runnable action) runAfterEitherAsync(CompletionStage<?> other, Runnable action) runAfterEitherAsync(CompletionStage<?> other, Runnable action, Executor executor) switchIfEmpty(Single<T> other) Switch to the other Single if the upstream is empty.takeUntil(Flow.Publisher<U> other) Relay upstream items until the other source signals an item or completes.thenAccept(Consumer<? super T> action) thenAcceptAsync(Consumer<? super T> action) thenAcceptAsync(Consumer<? super T> action, Executor executor) <U> CompletionAwaitable<Void>thenAcceptBoth(CompletionStage<? extends U> other, BiConsumer<? super T, ? super U> action) <U> CompletionAwaitable<Void>thenAcceptBothAsync(CompletionStage<? extends U> other, BiConsumer<? super T, ? super U> action) <U> CompletionAwaitable<Void>thenAcceptBothAsync(CompletionStage<? extends U> other, BiConsumer<? super T, ? super U> action, Executor executor) <U> CompletionAwaitable<U><U> CompletionAwaitable<U>thenApplyAsync(Function<? super T, ? extends U> fn) <U> CompletionAwaitable<U>thenApplyAsync(Function<? super T, ? extends U> fn, Executor executor) <U,V> CompletionAwaitable<V> thenCombine(CompletionStage<? extends U> other, BiFunction<? super T, ? super U, ? extends V> fn) <U,V> CompletionAwaitable<V> thenCombineAsync(CompletionStage<? extends U> other, BiFunction<? super T, ? super U, ? extends V> fn) <U,V> CompletionAwaitable<V> thenCombineAsync(CompletionStage<? extends U> other, BiFunction<? super T, ? super U, ? extends V> fn, Executor executor) <U> CompletionAwaitable<U>thenCompose(Function<? super T, ? extends CompletionStage<U>> fn) <U> CompletionAwaitable<U>thenComposeAsync(Function<? super T, ? extends CompletionStage<U>> fn) <U> CompletionAwaitable<U>thenComposeAsync(Function<? super T, ? extends CompletionStage<U>> fn, Executor executor) thenRunAsync(Runnable action) thenRunAsync(Runnable action, Executor executor) timeout(long timeout, TimeUnit unit, ScheduledExecutorService executor) Signals aTimeoutExceptionif the upstream doesn't signal an item, error or completion within the specified time.timeout(long timeout, TimeUnit unit, ScheduledExecutorService executor, Single<T> fallback) Switches to a fallback single if the upstream doesn't signal an item, error or completion within the specified time.timer(long time, TimeUnit unit, ScheduledExecutorService executor) Signal 0L and complete the sequence after the given time elapsed.default <U> UApply the givenconverterfunction to the currentSingleinstance and return the value returned by this function.default CompletionStage<T>toStage()Exposes thisSingleinstance as aCompletionStage.default CompletionStage<T>toStage(boolean completeWithoutValue) Exposes thisSingleinstance as aCompletionStage.whenComplete(BiConsumer<? super T, ? super Throwable> action) whenCompleteAsync(BiConsumer<? super T, ? super Throwable> action) whenCompleteAsync(BiConsumer<? super T, ? super Throwable> action, Executor executor) Methods inherited from interface io.helidon.common.reactive.Awaitable
await, await, await, toCompletableFutureMethods inherited from interface java.util.concurrent.CompletionStage
exceptionallyAsync, exceptionallyAsync, exceptionallyCompose, exceptionallyComposeAsync, exceptionallyComposeAsync, toCompletableFutureMethods inherited from interface java.util.concurrent.Flow.Publisher
subscribeMethods inherited from interface io.helidon.common.reactive.Subscribable
subscribe, subscribe, subscribe, subscribe
-
Method Details
-
defer
Call the given supplier function for each individual downstream Subscriber to return a Flow.Publisher to subscribe to.- Type Parameters:
T- the element type of the sequence- Parameters:
supplier- the callback to return a Flow.Publisher for each Subscriber- Returns:
- Multi
- Throws:
NullPointerException- ifsupplierisnull
-
empty
Get aSingleinstance that completes immediately.- Type Parameters:
T- item type- Returns:
- Single
-
error
Create aSingleinstance that reports the given given exception to its subscriber(s). The exception is reported by invokingFlow.Subscriber.onError(java.lang.Throwable)whenFlow.Publisher.subscribe(Subscriber)is called.- Type Parameters:
T- item type- Parameters:
error- exception to hold- Returns:
- Single
- Throws:
NullPointerException- if error isnull
-
from
Deprecated.usecreate(java.util.concurrent.CompletionStage)insteadWrap a CompletionStage into a Multi and signal its outcome non-blockingly.A null result from the CompletionStage will yield a
NullPointerExceptionsignal.- Type Parameters:
T- the element type of the stage and result- Parameters:
completionStage- the CompletionStage to- Returns:
- Single
- See Also:
-
from
Deprecated.Wrap a CompletionStage into a Multi and signal its outcome non-blockingly.- Type Parameters:
T- the element type of the stage and result- Parameters:
completionStage- the CompletionStage tonullMeansEmpty- if true, a null result is interpreted to be an empty sequence if false, the resulting sequence fails withNullPointerException- Returns:
- Single
-
from
Deprecated.usecreate(java.util.concurrent.Flow.Publisher)insteadCreate aSingleinstance that publishes the first and only item received from the given publisher. Note that if the publisher publishes more than one item, the resultingSinglewill hold an error. UseMulti.first()instead in order to get the first item of a publisher that may publish more than one item.- Type Parameters:
T- item type- Parameters:
source- source publisher- Returns:
- Single
- Throws:
NullPointerException- if source isnull
-
from
Deprecated.usecreate(io.helidon.common.reactive.Single)instead- Type Parameters:
T- item type- Parameters:
single- sourceSinglepublisher- Returns:
- Single
- Throws:
NullPointerException- if source isnull
-
create
Wrap a CompletionStage into a Multi and signal its outcome non-blockingly.A null result from the CompletionStage will yield a
NullPointerExceptionsignal.- Type Parameters:
T- the element type of the stage and result- Parameters:
completionStage- the CompletionStage to- Returns:
- Single
- See Also:
-
create
Wrap a CompletionStage into a Multi and signal its outcome non-blockingly.- Type Parameters:
T- the element type of the stage and result- Parameters:
completionStage- the CompletionStage tonullMeansEmpty- if true, a null result is interpreted to be an empty sequence if false, the resulting sequence fails withNullPointerException- Returns:
- Single
-
create
Create aSingleinstance that publishes the first and only item received from the given publisher. Note that if the publisher publishes more than one item, the resultingSinglewill hold an error. UseMulti.first()instead in order to get the first item of a publisher that may publish more than one item.- Type Parameters:
T- item type- Parameters:
source- source publisher- Returns:
- Single
- Throws:
NullPointerException- if source isnull
-
create
- Type Parameters:
T- item type- Parameters:
single- sourceSinglepublisher- Returns:
- Single
- Throws:
NullPointerException- if source isnull
-
just
Create aSingleinstance that publishes the given item to its subscriber(s).- Type Parameters:
T- item type- Parameters:
item- item to publish- Returns:
- Single
- Throws:
NullPointerException- if item isnull
-
create
Create aSingleinstance that publishes result of the given supplier to its subscriber(s).- Type Parameters:
T- item type- Parameters:
supplier- item supplier to publish- Returns:
- Single
- Throws:
NullPointerException- if item isnull
-
never
Get aSingleinstance that never completes.- Type Parameters:
T- item type- Returns:
- Single
-
timer
Signal 0L and complete the sequence after the given time elapsed.- Parameters:
time- the time to wait before signaling 0L and completionunit- the unit of timeexecutor- the executor to run the waiting on- Returns:
- Single
- Throws:
NullPointerException- ifunitorexecutorisnull
-
to
Apply the givenconverterfunction to the currentSingleinstance and return the value returned by this function.Note that the
converterfunction is executed upon calling this method immediately and not when the resulting sequence gets subscribed to.- Type Parameters:
U- the output type- Parameters:
converter- the function that receives the currentSingleinstance and should return a value to be returned by the method- Returns:
- the value returned by the function
- Throws:
NullPointerException- ifconverterisnull
-
compose
Apply the givencomposerfunction to the currentSingleinstance and return theSinglereturned by this function.Note that the
composerfunction is executed upon calling this method immediately and not when the resulting sequence gets subscribed to.- Type Parameters:
U- the output element type- Parameters:
composer- the function that receives the currentSingleinstance and should return aSingleto be returned by the method- Returns:
- Single
- Throws:
NullPointerException- ifcomposerisnull
-
defaultIfEmpty
Signals the default item if the upstream is empty.- Specified by:
defaultIfEmptyin interfaceSubscribable<T>- Parameters:
defaultItem- the item to signal if the upstream is empty- Returns:
- Single
- Throws:
NullPointerException- ifdefaultItemisnull
-
defaultIfEmpty
Signals the default item supplied by specified supplier if the upstream is empty.- Specified by:
defaultIfEmptyin interfaceSubscribable<T>- Parameters:
supplier- of the default value- Returns:
- Multi
- Throws:
NullPointerException- ifsupplierisnull
-
flatMap
- Specified by:
flatMapin interfaceSubscribable<T>- Type Parameters:
U- mapped items type- Parameters:
mapper- mapper- Returns:
- Publisher
- Throws:
NullPointerException- if mapper isnull
-
flatMapIterable
Maps the single upstream value into anIterableand relays its items to the downstream.- Specified by:
flatMapIterablein interfaceSubscribable<T>- Type Parameters:
U- the result type- Parameters:
mapper- the function that receives the single upstream value and should return an Iterable instance- Returns:
- Multi
- Throws:
NullPointerException- ifmapperisnull
-
flatMapSingle
Transforms item with supplied function and flatten resultingSingleto downstream.- Type Parameters:
U- mapped items type- Parameters:
mapper- mapper- Returns:
- Single
- Throws:
NullPointerException- if mapper isnull
-
flatMapCompletionStage
default <U> Single<U> flatMapCompletionStage(Function<? super T, ? extends CompletionStage<? extends U>> mapper) Transforms item with supplied function and flatten resultingCompletionStageresult to downstream. As reactive streams forbids null values, CompletionStage result is mapped toOptional.- Type Parameters:
U- mapped items type- Parameters:
mapper- mapper- Returns:
- Single
- Throws:
NullPointerException- if mapper isnull
-
flatMapOptional
Transform item with supplied function and flatten resultingOptionalto downstream as Single with its value as item if present or empty Single.- Type Parameters:
U- mapped item type- Parameters:
mapper- mapper- Returns:
- Single
- Throws:
NullPointerException- if mapper isnull
-
map
- Specified by:
mapin interfaceSubscribable<T>- Type Parameters:
U- mapped item type- Parameters:
mapper- mapper- Returns:
- Single
- Throws:
NullPointerException- if mapper isnull
-
observeOn
Re-emit the upstream's signals to the downstream on the given executor's thread.- Specified by:
observeOnin interfaceSubscribable<T>- Parameters:
executor- the executor to signal the downstream from.- Returns:
- Single
- Throws:
NullPointerException- ifexecutorisnull
-
onCancel
Executes givenRunnablewhen a cancel signal is received.- Specified by:
onCancelin interfaceSubscribable<T>- Parameters:
onCancel-Runnableto be executed.- Returns:
- Single
-
onComplete
Executes givenRunnablewhen onComplete signal is received.- Specified by:
onCompletein interfaceSubscribable<T>- Parameters:
onComplete-Runnableto be executed.- Returns:
- Single
-
onError
Executes givenConsumerwhen onError signal is received.- Specified by:
onErrorin interfaceSubscribable<T>- Parameters:
onErrorConsumer-Consumerto be executed.- Returns:
- Single
-
onErrorResume
Functionproviding one item to be submitted as onNext in case of onError signal is received.- Specified by:
onErrorResumein interfaceSubscribable<T>- Parameters:
onError- Function receivingThrowableas argument and producing one item to resume stream with.- Returns:
- Single
-
onErrorResumeWithSingle
default Single<T> onErrorResumeWithSingle(Function<? super Throwable, ? extends Single<? extends T>> onError) Resume stream from supplied publisher if onError signal is intercepted.- Parameters:
onError- supplier of new stream publisher- Returns:
- Single
-
onErrorResumeWith
default Multi<T> onErrorResumeWith(Function<? super Throwable, ? extends Flow.Publisher<? extends T>> onError) Resume stream from supplied publisher if onError signal is intercepted.- Specified by:
onErrorResumeWithin interfaceSubscribable<T>- Parameters:
onError- supplier of new stream publisher- Returns:
- Single
-
onCompleteResume
Resume stream from single item if onComplete signal is intercepted. Effectively do anappendto the stream.- Specified by:
onCompleteResumein interfaceSubscribable<T>- Parameters:
item- one item to resume stream with- Returns:
- Multi
-
onCompleteResumeWith
Resume stream from supplied publisher if onComplete signal is intercepted.- Specified by:
onCompleteResumeWithin interfaceSubscribable<T>- Parameters:
publisher- new stream publisher- Returns:
- Multi
-
onCompleteResumeWithSingle
default Single<T> onCompleteResumeWithSingle(Function<Optional<T>, ? extends Single<? extends T>> onComplete) Resume stream with supplied single if onComplete signal is intercepted.- Parameters:
onComplete- function for supplying new Single with optional upstream value as a parameter- Returns:
- Single
-
onTerminate
Executes givenRunnablewhen any of signals onComplete, onCancel or onError is received.- Specified by:
onTerminatein interfaceSubscribable<T>- Parameters:
onTerminate-Runnableto be executed.- Returns:
- Single
-
ifEmpty
Executes givenRunnablewhen stream is finished without value(empty stream).- Parameters:
ifEmpty-Runnableto be executed.- Returns:
- Multi
-
peek
Invoke provided consumer for the item in stream.- Specified by:
peekin interfaceSubscribable<T>- Parameters:
consumer- consumer to be invoked- Returns:
- Single
-
log
Log all signalsonSubscribe,onNext,onError,onComplete,cancelandrequestcoming to and from preceding operator.- Returns:
- Multi
-
log
Log all signalsonSubscribe,onNext,onError,onComplete,cancelandrequestcoming to and from preceding operator.- Parameters:
level- a logging level value- Returns:
- Multi
-
log
Log all signalsonSubscribe,onNext,onError,onComplete,cancelandrequestcoming to and from preceding operator.- Parameters:
level- a logging level valueloggerName- custom logger name- Returns:
- Multi
-
log
Log all signalsonSubscribe,onNext,onError,onComplete,cancelandrequestcoming to and from preceding operator.Enabled trace option has a negative impact on performance and should NOT be used in production.
- Parameters:
level- a logging level valuetrace- if true position of operator is looked up from stack and logged- Returns:
- Multi
-
retry
Retry a failing upstream at most the given number of times before giving up.- Specified by:
retryin interfaceSubscribable<T>- Parameters:
count- the number of times to retry; 0 means no retry at all- Returns:
- Single
- Throws:
IllegalArgumentException- ifcountis negative- See Also:
-
retry
Retry a failing upstream if the predicate returns true.- Specified by:
retryin interfaceSubscribable<T>- Parameters:
predicate- the predicate that receives the latest failureThrowablethe number of times the retry happened so far (0-based) and should returntrueto retry the upstream again orfalseto signal the latest failure- Returns:
- Single
- Throws:
NullPointerException- ifpredicateisnull- See Also:
-
retryWhen
default <U> Single<T> retryWhen(BiFunction<? super Throwable, ? super Long, ? extends Flow.Publisher<U>> whenFunction) Retry a failing upstream when the given function returns a publisher that signals an item.If the publisher returned by the function completes, the repetition stops and this Single is completed as empty. If the publisher signals an error, the repetition stops and this Single will signal this error.
- Specified by:
retryWhenin interfaceSubscribable<T>- Type Parameters:
U- the element type of the retry-signal sequence- Parameters:
whenFunction- the function that receives the latest failureThrowablethe number of times the retry happened so far (0-based) and should return aFlow.Publisherthat should signal an item to retry again, complete to stop and complete this Single or signal an error to have this Single emit that error as well.- Returns:
- Single
- Throws:
NullPointerException- ifwhenFunctionisnull
-
switchIfEmpty
Switch to the other Single if the upstream is empty.- Parameters:
other- the Single to switch to if the upstream is empty.- Returns:
- Single
- Throws:
NullPointerException- ifotherisnull
-
takeUntil
Relay upstream items until the other source signals an item or completes.- Specified by:
takeUntilin interfaceSubscribable<T>- Type Parameters:
U- the element type of the other sequence- Parameters:
other- the other sequence to signal the end of the main sequence- Returns:
- Single
- Throws:
NullPointerException- ifotherisnull
-
timeout
Signals aTimeoutExceptionif the upstream doesn't signal an item, error or completion within the specified time.- Specified by:
timeoutin interfaceSubscribable<T>- Parameters:
timeout- the time to wait for the upstream to signalunit- the time unitexecutor- the executor to use for waiting for the upstream signal- Returns:
- Single
- Throws:
NullPointerException- ifunitorexecutorisnull
-
timeout
default Single<T> timeout(long timeout, TimeUnit unit, ScheduledExecutorService executor, Single<T> fallback) Switches to a fallback single if the upstream doesn't signal an item, error or completion within the specified time.- Parameters:
timeout- the time to wait for the upstream to signalunit- the time unitexecutor- the executor to use for waiting for the upstream signalfallback- the Single to switch to if the upstream doesn't signal in time- Returns:
- Single
- Throws:
NullPointerException- ifunit,executororfallbackisnull
-
get
Short-hand fortoFuture().toCompletableFuture().get().- Returns:
- T
- Throws:
InterruptedException- if the current thread was interrupted while waitingExecutionException- if the future completed exceptionally
-
get
default T get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException Short-hand fortoFuture().toCompletableFuture().get().- Parameters:
timeout- the maximum time to waitunit- the time unit of the timeout argument- Returns:
- T
- Throws:
InterruptedException- if the current thread was interrupted while waitingExecutionException- if the future completed exceptionallyTimeoutException- if the wait timed out
-
toOptionalSingle
Exposes thisSingleinstance as aSinglewithOptional<T>return type of the asynchronous operation. If thisSinglecompletes without a value, the resultingSinglecompletes with an emptyOptional.- Returns:
- CompletionStage
-
toStage
Exposes thisSingleinstance as aCompletionStage. Note that if thisSinglecompletes without a value, the resultingCompletionStagewill be completed exceptionally with anIllegalStateException- Returns:
- CompletionStage
-
toStage
Exposes thisSingleinstance as aCompletionStage. Note that if thisSinglecompletes without a value andcompleteWithoutValueis set tofalse, the resultingCompletionStagewill be completed exceptionally with anIllegalStateException- Parameters:
completeWithoutValue- Allow completion without a value.- Returns:
- CompletionStage
-
forSingle
Terminal stage, invokes provided consumer when Single is completed.- Parameters:
consumer- consumer to be invoked- Returns:
- CompletionStage completed when the stream terminates
-
ignoreElement
Terminal stage, ignore onNext signals, only onComplete and onError signals are propagated.- Returns:
- CompletionStage completed when the stream terminates
-
cancel
Cancel upstream.- Returns:
- new
Singlefor eventually received single value.
-
thenApply
- Specified by:
thenApplyin interfaceCompletionStage<T>
-
thenApplyAsync
- Specified by:
thenApplyAsyncin interfaceCompletionStage<T>
-
thenApplyAsync
- Specified by:
thenApplyAsyncin interfaceCompletionStage<T>
-
thenAccept
- Specified by:
thenAcceptin interfaceCompletionStage<T>
-
thenAcceptAsync
- Specified by:
thenAcceptAsyncin interfaceCompletionStage<T>
-
thenAcceptAsync
- Specified by:
thenAcceptAsyncin interfaceCompletionStage<T>
-
thenRun
- Specified by:
thenRunin interfaceCompletionStage<T>
-
thenRunAsync
- Specified by:
thenRunAsyncin interfaceCompletionStage<T>
-
thenRunAsync
- Specified by:
thenRunAsyncin interfaceCompletionStage<T>
-
thenCombine
<U,V> CompletionAwaitable<V> thenCombine(CompletionStage<? extends U> other, BiFunction<? super T, ? super U, ? extends V> fn) - Specified by:
thenCombinein interfaceCompletionStage<T>
-
thenCombineAsync
<U,V> CompletionAwaitable<V> thenCombineAsync(CompletionStage<? extends U> other, BiFunction<? super T, ? super U, ? extends V> fn) - Specified by:
thenCombineAsyncin interfaceCompletionStage<T>
-
thenCombineAsync
<U,V> CompletionAwaitable<V> thenCombineAsync(CompletionStage<? extends U> other, BiFunction<? super T, ? super U, ? extends V> fn, Executor executor) - Specified by:
thenCombineAsyncin interfaceCompletionStage<T>
-
thenAcceptBoth
<U> CompletionAwaitable<Void> thenAcceptBoth(CompletionStage<? extends U> other, BiConsumer<? super T, ? super U> action) - Specified by:
thenAcceptBothin interfaceCompletionStage<T>
-
thenAcceptBothAsync
<U> CompletionAwaitable<Void> thenAcceptBothAsync(CompletionStage<? extends U> other, BiConsumer<? super T, ? super U> action) - Specified by:
thenAcceptBothAsyncin interfaceCompletionStage<T>
-
thenAcceptBothAsync
<U> CompletionAwaitable<Void> thenAcceptBothAsync(CompletionStage<? extends U> other, BiConsumer<? super T, ? super U> action, Executor executor) - Specified by:
thenAcceptBothAsyncin interfaceCompletionStage<T>
-
runAfterBoth
- Specified by:
runAfterBothin interfaceCompletionStage<T>
-
runAfterBothAsync
- Specified by:
runAfterBothAsyncin interfaceCompletionStage<T>
-
runAfterBothAsync
CompletionAwaitable<Void> runAfterBothAsync(CompletionStage<?> other, Runnable action, Executor executor) - Specified by:
runAfterBothAsyncin interfaceCompletionStage<T>
-
applyToEither
<U> CompletionAwaitable<U> applyToEither(CompletionStage<? extends T> other, Function<? super T, U> fn) - Specified by:
applyToEitherin interfaceCompletionStage<T>
-
applyToEitherAsync
<U> CompletionAwaitable<U> applyToEitherAsync(CompletionStage<? extends T> other, Function<? super T, U> fn) - Specified by:
applyToEitherAsyncin interfaceCompletionStage<T>
-
applyToEitherAsync
<U> CompletionAwaitable<U> applyToEitherAsync(CompletionStage<? extends T> other, Function<? super T, U> fn, Executor executor) - Specified by:
applyToEitherAsyncin interfaceCompletionStage<T>
-
acceptEither
CompletionAwaitable<Void> acceptEither(CompletionStage<? extends T> other, Consumer<? super T> action) - Specified by:
acceptEitherin interfaceCompletionStage<T>
-
acceptEitherAsync
CompletionAwaitable<Void> acceptEitherAsync(CompletionStage<? extends T> other, Consumer<? super T> action) - Specified by:
acceptEitherAsyncin interfaceCompletionStage<T>
-
acceptEitherAsync
CompletionAwaitable<Void> acceptEitherAsync(CompletionStage<? extends T> other, Consumer<? super T> action, Executor executor) - Specified by:
acceptEitherAsyncin interfaceCompletionStage<T>
-
runAfterEither
- Specified by:
runAfterEitherin interfaceCompletionStage<T>
-
runAfterEitherAsync
- Specified by:
runAfterEitherAsyncin interfaceCompletionStage<T>
-
runAfterEitherAsync
CompletionAwaitable<Void> runAfterEitherAsync(CompletionStage<?> other, Runnable action, Executor executor) - Specified by:
runAfterEitherAsyncin interfaceCompletionStage<T>
-
thenCompose
- Specified by:
thenComposein interfaceCompletionStage<T>
-
thenComposeAsync
- Specified by:
thenComposeAsyncin interfaceCompletionStage<T>
-
thenComposeAsync
<U> CompletionAwaitable<U> thenComposeAsync(Function<? super T, ? extends CompletionStage<U>> fn, Executor executor) - Specified by:
thenComposeAsyncin interfaceCompletionStage<T>
-
handle
- Specified by:
handlein interfaceCompletionStage<T>
-
handleAsync
- Specified by:
handleAsyncin interfaceCompletionStage<T>
-
handleAsync
<U> CompletionAwaitable<U> handleAsync(BiFunction<? super T, Throwable, ? extends U> fn, Executor executor) - Specified by:
handleAsyncin interfaceCompletionStage<T>
-
whenComplete
- Specified by:
whenCompletein interfaceCompletionStage<T>
-
whenCompleteAsync
- Specified by:
whenCompleteAsyncin interfaceCompletionStage<T>
-
whenCompleteAsync
CompletionAwaitable<T> whenCompleteAsync(BiConsumer<? super T, ? super Throwable> action, Executor executor) - Specified by:
whenCompleteAsyncin interfaceCompletionStage<T>
-
exceptionally
- Specified by:
exceptionallyin interfaceCompletionStage<T>
-
exceptionallyAccept
Returns a new CompletionAwaitable that, when this stage completes exceptionally, is executed with this stage's exception as the argument to the supplied consumer. Otherwise, if this stage completes normally, then the returned stage also completes normally with the same value.- Parameters:
consumer- the consumer to invoke if this CompletionAwaitable completed exceptionally- Returns:
- the new CompletionAwaitable
-
create(io.helidon.common.reactive.Single)instead