O
- the type of the value that will be made availablepublic final class MonoProcessor<O> extends Mono<O> implements org.reactivestreams.Processor<O,O>, Cancellation, org.reactivestreams.Subscription, Trackable, Receiver, Producer, java.util.function.LongSupplier
MonoProcessor
is a Mono
extension that implements stateful semantics. Multi-subscribe is allowed.
Once a MonoProcessor
has been resolved, newer subscribers will benefit from the cached result.
UNSPECIFIED
Modifier and Type | Method and Description |
---|---|
O |
block()
Block until a next signal is received, will return null if onComplete, T if onNext, throw a
Exceptions.DownstreamException if checked error or origin RuntimeException if unchecked.
|
O |
blockMillis(long timeout)
Block the calling thread for the specified time, waiting for the completion of this
MonoProcessor . |
void |
cancel() |
static <T> MonoProcessor<T> |
create()
Create a
MonoProcessor that will eagerly request 1 on onSubscribe(Subscription) , cache and emit
the eventual result for 1 or N subscribers. |
static <T> MonoProcessor<T> |
create(WaitStrategy waitStrategy)
Create a
MonoProcessor that will eagerly request 1 on onSubscribe(Subscription) , cache and emit
the eventual result for 1 or N subscribers. |
void |
dispose()
Cancel or dispose the underlying task or resource.
|
org.reactivestreams.Subscriber<O> |
downstream()
Return the direct data receiver.
|
long |
expectedFromUpstream() |
long |
getAsLong()
Returns the internal state from -1 Cancelled to 5 errored, beyond 3 included is
fulfilled.
|
java.lang.Throwable |
getError()
Current error if any, default to null
|
long |
getPending()
Return current used space in buffer
|
boolean |
isCancelled() |
boolean |
isError()
Indicates whether this
MonoProcessor has been completed with an error. |
boolean |
isStarted()
Has this upstream started or "onSubscribed" ?
|
boolean |
isSuccess()
Indicates whether this
MonoProcessor has been successfully completed a value. |
boolean |
isTerminated()
Has this upstream finished or "completed" / "failed" ?
|
long |
limit() |
void |
onComplete() |
void |
onError(java.lang.Throwable cause) |
void |
onNext(O value) |
void |
onSubscribe(org.reactivestreams.Subscription subscription) |
O |
peek()
Returns the value that completed this
MonoProcessor . |
void |
request(long n) |
void |
subscribe(org.reactivestreams.Subscriber<? super O> subscriber) |
java.lang.Object |
upstream()
Return the direct source of data, Supports reference.
|
and, as, awaitOnSubscribe, block, cache, cancelOn, cast, compose, concatWith, create, defaultIfEmpty, defer, delay, delayMillis, delayMillis, delaySubscription, delaySubscription, delaySubscriptionMillis, delaySubscriptionMillis, dematerialize, doAfterTerminate, doOnCancel, doOnError, doOnError, doOnError, doOnNext, doOnRequest, doOnSubscribe, doOnSuccess, doOnTerminate, elapsed, elapsed, empty, empty, error, filter, first, first, flatMap, flatMap, flatMapIterable, flux, from, fromCallable, fromFuture, fromRunnable, fromSupplier, handle, hasElement, hide, ignoreElement, ignoreElements, just, justOrEmpty, justOrEmpty, log, log, log, log, map, mapError, mapError, mapError, materialize, mergeWith, never, ofType, onAssembly, onTerminateDetach, or, otherwise, otherwise, otherwise, otherwiseIfEmpty, otherwiseReturn, otherwiseReturn, otherwiseReturn, publish, publishOn, repeat, repeat, repeat, repeat, repeatWhen, repeatWhenEmpty, repeatWhenEmpty, retry, retry, retry, retry, retryWhen, sequenceEqual, sequenceEqual, sequenceEqual, subscribe, subscribe, subscribe, subscribe, subscribeOn, subscribeWith, then, then, then, then, thenMany, thenMany, timeout, timeout, timeout, timeout, timeoutMillis, timeoutMillis, timeoutMillis, timeoutMillis, timestamp, timestamp, toFuture, toString, transform, using, using, when, when, when, when, when, when, when, when, when, whenDelayError, whenDelayError, whenDelayError, whenDelayError, whenDelayError, whenDelayError, whenDelayError, zip, zip
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getCapacity, requestedFromDownstream
public static <T> MonoProcessor<T> create()
MonoProcessor
that will eagerly request 1 on onSubscribe(Subscription)
, cache and emit
the eventual result for 1 or N subscribers.T
- type of the expected valueMonoProcessor
.public static <T> MonoProcessor<T> create(WaitStrategy waitStrategy)
MonoProcessor
that will eagerly request 1 on onSubscribe(Subscription)
, cache and emit
the eventual result for 1 or N subscribers.T
- type of the expected valuewaitStrategy
- a WaitStrategy
for blocking block()
strategyMonoProcessor
.public final void cancel()
cancel
in interface org.reactivestreams.Subscription
public void dispose()
Cancellation
Call to this method is/should be idempotent.
dispose
in interface Cancellation
public final org.reactivestreams.Subscriber<O> downstream()
Producer
downstream
in interface Producer
public long expectedFromUpstream()
expectedFromUpstream
in interface Trackable
public O block()
Mono
public O blockMillis(long timeout)
MonoProcessor
. If the
MonoProcessor
is completed with an error a RuntimeException that wraps the error is thrown.blockMillis
in class Mono<O>
timeout
- the timeout value in millisecondsMonoProcessor
or null
if the timeout is reached and the MonoProcessor
has
not completedpublic final java.lang.Throwable getError()
Trackable
public long getPending()
Trackable
getPending
in interface Trackable
public boolean isCancelled()
isCancelled
in interface Trackable
public final boolean isError()
MonoProcessor
has been completed with an error.true
if this MonoProcessor
was completed with an error, false
otherwise.public final boolean isStarted()
Trackable
public final boolean isSuccess()
MonoProcessor
has been successfully completed a value.true
if this MonoProcessor
is successful, false
otherwise.public final boolean isTerminated()
Trackable
isTerminated
in interface Trackable
public long limit()
public final void onComplete()
onComplete
in interface org.reactivestreams.Subscriber<O>
public final void onError(java.lang.Throwable cause)
onError
in interface org.reactivestreams.Subscriber<O>
public final void onNext(O value)
onNext
in interface org.reactivestreams.Subscriber<O>
public final void onSubscribe(org.reactivestreams.Subscription subscription)
onSubscribe
in interface org.reactivestreams.Subscriber<O>
public long getAsLong()
getAsLong
in interface java.util.function.LongSupplier
public O peek()
MonoProcessor
. Returns null
if the MonoProcessor
has not been completed. If the
MonoProcessor
is completed with an error a RuntimeException that wraps the error is thrown.MonoProcessor
, or null
if it has not been completedjava.lang.RuntimeException
- if the MonoProcessor
was completed with an errorpublic final void request(long n)
request
in interface org.reactivestreams.Subscription
public void subscribe(org.reactivestreams.Subscriber<? super O> subscriber)
subscribe
in interface org.reactivestreams.Publisher<O>