Top Description Fields Constructors Methods
reactor.core.publisher

pack-priv final Class BlockingOptionalMonoSubscriber<T>

extends CountDownLatch
implements InnerConsumer<T>, Disposable
Class Inheritance
All Implemented Interfaces
reactor.core.Disposable, reactor.core.publisher.InnerConsumer, reactor.core.Scannable, reactor.core.CoreSubscriber, org.reactivestreams.Subscriber
Type Parameters
<T>
the value type
Imports
java.util.Optional, java.util.concurrent.CountDownLatch, .TimeUnit, org.reactivestreams.Subscription, reactor.core.Disposable, .Exceptions, reactor.core.scheduler.Schedulers, reactor.util.annotation.Nullable, reactor.util.context.Context

Blocks assuming the upstream is a Mono, until it signals its value or completes. Similar to BlockingSingleSubscriber, except blockGet methods return an Optional and thus aren't nullable.
See Also
https://github.com/reactor/reactive-streams-commons

Field Summary

Modifier and TypeField and Description
pack-priv volatile boolean
pack-priv final Context
pack-priv Throwable
pack-priv Subscription
s

pack-priv T

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv final Optional<T>

Returns:

an Optional representing the first value (or empty Optional if the source is empty)
blockingGet
()

Block until the first value arrives or the source completes empty, and return it as an Optional.

pack-priv final Optional<T>

Returns:

an Optional representing the first value (or empty Optional if the source is empty)
blockingGet
(long
the timeout to wait
timeout
,
TimeUnit
the time unit
unit
)

Block until the first value arrives or the source completes empty, and return it as an Optional.

public Context
currentContext()

Overrides default reactor.core.CoreSubscriber.currentContext.

Request a Context from dependent components which can include downstream operators during subscribing or a terminal org.reactivestreams.Subscriber.
public final void
dispose()

Implements reactor.core.Disposable.dispose.

Cancel or dispose the underlying task or resource.
public boolean
isDisposed()

Overrides default reactor.core.Disposable.isDisposed.

Optionally return true when the resource or task is disposed.
public final void
onComplete()

Implements org.reactivestreams.Subscriber.onComplete.

Successful terminal state.
public void
onError(Throwable
the throwable signaled
t
)

Implements org.reactivestreams.Subscriber.onError.

Failed terminal state.
public void
onNext(T
the element signaled
t
)

Implements org.reactivestreams.Subscriber.onNext.

Data notification sent by the Publisher in response to requests to Subscription#request(long).
public final void
onSubscribe(Subscription
the Subscription that allows requesting data via Subscription#request(long)
s
)

Implements reactor.core.CoreSubscriber.onSubscribe.

Implementors should initialize any state used by onNext(Object) before calling Subscription#request(long).
public Object
scanUnsafe(Scannable.Attr<T>
a Attr to resolve for the component.
key
)

Implements reactor.core.Scannable.scanUnsafe.

This method is used internally by components to define their key-value mappings in a single place.
public String
stepName()

Overrides default reactor.core.Scannable.stepName.

Return a meaningful String representation of this Scannable in its chain of parents() and actuals().
Inherited from java.util.concurrent.CountDownLatch:
awaitawaitcountDowngetCounttoString

Field Detail

cancelledback to summary
pack-priv volatile boolean cancelled
contextback to summary
pack-priv final Context context
errorback to summary
pack-priv Throwable error
sback to summary
pack-priv Subscription s
valueback to summary
pack-priv T value

Constructor Detail

BlockingOptionalMonoSubscriberback to summary
pack-priv BlockingOptionalMonoSubscriber(Context context)

Method Detail

blockingGetback to summary
pack-priv final Optional<T> blockingGet()

Block until the first value arrives or the source completes empty, and return it as an Optional. Rethrow any exception.

Returns:Optional<T>

an Optional representing the first value (or empty Optional if the source is empty)

blockingGetback to summary
pack-priv final Optional<T> blockingGet(long timeout, TimeUnit unit)

Block until the first value arrives or the source completes empty, and return it as an Optional. Rethrow any exception.

Parameters
timeout:long

the timeout to wait

unit:TimeUnit

the time unit

Returns:Optional<T>

an Optional representing the first value (or empty Optional if the source is empty)

currentContextback to summary
public Context currentContext()

Overrides default reactor.core.CoreSubscriber.currentContext.

Doc from reactor.core.CoreSubscriber.currentContext.

Request a Context from dependent components which can include downstream operators during subscribing or a terminal org.reactivestreams.Subscriber.

Returns:Context

a resolved context or Context#empty()

Annotations
@Override
disposeback to summary
public final void dispose()

Implements reactor.core.Disposable.dispose.

Doc from reactor.core.Disposable.dispose.

Cancel or dispose the underlying task or resource.

Implementations are required to make this method idempotent.

Annotations
@Override
isDisposedback to summary
public boolean isDisposed()

Overrides default reactor.core.Disposable.isDisposed.

Doc from reactor.core.Disposable.isDisposed.

Optionally return true when the resource or task is disposed.

Implementations are not required to track disposition and as such may never return true even when disposed. However, they MUST only return true when there's a guarantee the resource or task is disposed.

Returns:boolean

true when there's a guarantee the resource or task is disposed.

Annotations
@Override
onCompleteback to summary
public final void onComplete()

Implements org.reactivestreams.Subscriber.onComplete.

Doc from org.reactivestreams.Subscriber.onComplete.

Successful terminal state.

No further events will be sent even if Subscription#request(long) is invoked again.

Annotations
@Override
onErrorback to summary
public void onError(Throwable t)

Implements org.reactivestreams.Subscriber.onError.

Doc from org.reactivestreams.Subscriber.onError.

Failed terminal state.

No further events will be sent even if Subscription#request(long) is invoked again.

Parameters
t:Throwable

the throwable signaled

Annotations
@Override
onNextback to summary
public void onNext(T t)

Implements org.reactivestreams.Subscriber.onNext.

Doc from org.reactivestreams.Subscriber.onNext.

Data notification sent by the Publisher in response to requests to Subscription#request(long).

Parameters
t:T

the element signaled

Annotations
@Override
onSubscribeback to summary
public final void onSubscribe(Subscription s)

Implements reactor.core.CoreSubscriber.onSubscribe.

Doc from reactor.core.CoreSubscriber.onSubscribe.

Implementors should initialize any state used by onNext(Object) before calling Subscription#request(long). Should further onNext related state modification occur, thread-safety will be required.

Note that an invalid request <= 0 will not produce an onError and will simply be ignored or reported through a debug-enabled reactor.util.Logger. Invoked after calling Publisher#subscribe(Subscriber).

No data will start flowing until Subscription#request(long) is invoked.

It is the responsibility of this Subscriber instance to call Subscription#request(long) whenever more data is wanted.

The Publisher will send notifications only in response to Subscription#request(long).

Parameters
s:Subscription

Doc from org.reactivestreams.Subscriber.onSubscribe.

the Subscription that allows requesting data via Subscription#request(long)

Annotations
@Override
scanUnsafeback to summary
public Object scanUnsafe(Scannable.Attr<T> key)

Implements reactor.core.Scannable.scanUnsafe.

Doc from reactor.core.Scannable.scanUnsafe.

This method is used internally by components to define their key-value mappings in a single place. Although it is ignoring the generic type of the Attr key, implementors should take care to return values of the correct type, and return null if no specific value is available.

For public consumption of attributes, prefer using scan(Attr), which will return a typed value and fall back to the key's default if the component didn't define any mapping.

Parameters
key:Scannable.Attr<T>

a Attr to resolve for the component.

Returns:Object

the value associated to the key for that specific component, or null if none.

Annotations
@Override
@Nullable
stepNameback to summary
public String stepName()

Overrides default reactor.core.Scannable.stepName.

Doc from reactor.core.Scannable.stepName.

Return a meaningful String representation of this Scannable in its chain of parents() and actuals().

Annotations
@Override