Deprecated
to be removed in 3.5, prefer clear cut usage of Sinks through
variations under Sinks..
Note
UnicastProcessor does not respect the actual subscriber's demand as it is described in Reactive Streams Spec. However, UnicastProcessor embraces configurable Queue internally which allows enabling backpressure support and preventing of consumer's overwhelming. Hence, interaction model between producers and UnicastProcessor will be PUSH only. In opposite, interaction model between UnicastProcessor and consumer will be PUSH-PULL as defined in Reactive Streams Spec. In the case when upstream's signals overflow the bound of internal Queue, UnicastProcessor will fail with signaling onError( reactor.core.Exceptions.OverflowException).
Note
The implementation keeps the order of signals. That means that in case of terminal signal (completion or error signals) it will be postponed until all of the previous signals has been consumed.
| Modifier and Type | Field and Description |
|---|---|
| pack-priv volatile CoreSubscriber | |
| pack-priv volatile boolean | |
| pack-priv static final AtomicIntegerFieldUpdater | |
| pack-priv volatile int | |
| pack-priv volatile boolean | |
| pack-priv Throwable | |
| pack-priv boolean | |
| pack-priv static final AtomicReferenceFieldUpdater | |
| pack-priv volatile int | |
| pack-priv static final AtomicIntegerFieldUpdater | |
| pack-priv final Consumer | |
| pack-priv volatile Disposable | |
| pack-priv boolean | |
| pack-priv final Queue | |
| pack-priv volatile long | |
| pack-priv static final AtomicLongFieldUpdater | |
| pack-priv volatile int | |
| pack-priv static final AtomicIntegerFieldUpdater |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public CoreSubscriber | |
| public Flux | |
| public void | cancel()
Implements org. Publisher to stop sending data and clean up resources.
|
| pack-priv boolean | |
| public void | clear()
Implements java. |
| public static < the relayed type E> UnicastProcessor | Returns: a unicastFluxProcessor
Deprecated
use
Create a new Sinks.
(or the unsafe variant if you're sure about external synchronization).
UnicastProcessor that will buffer on an internal queue in an
unbounded fashion.
|
| public static < the relayed type E> UnicastProcessor | Returns: a unicastFluxProcessorthe buffering queue queue)
Deprecated
use
Create a new Sinks.
(or the unsafe variant if you're sure about external synchronization).
UnicastProcessor that will buffer on a provided queue in an
unbounded fashion.
|
| public static < the relayed type E> UnicastProcessor | Returns: a unicastFluxProcessorthe buffering queue queue, Disposable called on any terminal signal endcallback)
Deprecated
use
Create a new Sinks.
(or the unsafe variant if you're sure about external synchronization).
UnicastProcessor that will buffer on a provided queue in an
unbounded fashion.
|
| public static < the relayed type E> UnicastProcessor | Returns: a unicastFluxProcessorthe buffering queue queue, Consumer<? super E> called when queue.offer return false and unicastProcessor is
about to emit onError. onOverflow, Disposable called on any terminal signal endcallback)
Deprecated
use
Create a new Sinks.
(or the unsafe variant if you're sure about external synchronization).
UnicastProcessor that will buffer on a provided queue in an
unbounded fashion.
|
| public Context | currentContext()
Overrides reactor. Overrides default reactor. Implements reactor. Context from dependent components which can include downstream
operators during subscribing or a terminal org..
|
| public int | currentSubscriberCount()
Implements reactor. Subscribers are currently subscribed to the sink.
|
| pack-priv void | |
| public long | downstreamCount()
Overrides reactor. Subscriber or -1 if untracked.
|
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| public void | emitNext(T
the value to emit, not null value, Sinks.the failure handler that allows retrying failed failureHandlerEmitResult.Overrides default reactor. tryEmitNext(Object) API, generating an
onNext signal.
|
| public int | getBufferSize()
Overrides reactor. Integer#MAX_VALUE
|
| public Throwable | getError()
Current error if any, default to null
|
| public int | getPrefetch()
Overrides reactor. Flux
|
| public boolean | hasDownstreams()
Overrides reactor. Subscriber is actively subscribed
|
| public Stream | inners()
Overrides reactor. Overrides default reactor. Stream of referenced inners (flatmap, multicast etc)
|
| public boolean | isDisposed()
Overrides default reactor. |
| public boolean | isEmpty()
Implements java. true if this collection contains no elements.
|
| protected boolean | isIdentityProcessor()
Overrides reactor. FluxProcessor<T, T>
|
| public boolean | isTerminated()
Overrides reactor. |
| public void | |
| public void | onError(Throwable
the throwable signaled throwable)Implements org. |
| public void | onNext(T
the element signaled t)Implements org. Publisher in response to requests to Subscription#request(long).
|
| public void | onSubscribe(Subscription
the s)Subscription that allows requesting data via Subscription#request(long)Implements reactor. onNext(Object) before
calling Subscription#request(long).
|
| public T | poll()
Implements java. null if this queue is empty.
|
| public void | request(long
the strictly positive number of elements to requests to the upstream n)PublisherImplements org. Publisher until demand is signaled via this method.
|
| public int | requestFusion(int
the mode requested by the intermediate operator requestedMode)Implements reactor. |
| public Object | scanUnsafe(Scannable.
a keyAttr to resolve for the component.Overrides reactor. Overrides default reactor. Implements reactor. |
| public int | |
| public void | subscribe(CoreSubscriber<? super T>
the actual)Subscriber interested into the published sequenceImplements abstract reactor. Implements reactor. Publisher#subscribe(Subscriber) that will bypass
Hooks#onLastOperator(Function) pointcut.
|
| public Sinks. | tryEmitComplete()
Implements reactor. onComplete
signal.
|
| public Sinks. | tryEmitError(Throwable
the exception to signal, not null t)Implements reactor. onError
signal.
|
| public Sinks. | tryEmitNext(T
the value to emit, not null t)Implements reactor. onNext signal.
|
| actual | back to summary |
|---|---|
| pack-priv volatile CoreSubscriber<? super T> actual | |
| cancelled | back to summary |
|---|---|
| pack-priv volatile boolean cancelled | |
| DISCARD_GUARD | back to summary |
|---|---|
pack-priv static final AtomicIntegerFieldUpdater<UnicastProcessor<T>> DISCARD_GUARD
| |
| discardGuard | back to summary |
|---|---|
| pack-priv volatile int discardGuard | |
| done | back to summary |
|---|---|
| pack-priv volatile boolean done | |
| error | back to summary |
|---|---|
| pack-priv Throwable error | |
| hasDownstream | back to summary |
|---|---|
| pack-priv boolean hasDownstream | |
| ON_TERMINATE | back to summary |
|---|---|
pack-priv static final AtomicReferenceFieldUpdater<UnicastProcessor<T>, Disposable> ON_TERMINATE
| |
| once | back to summary |
|---|---|
| pack-priv volatile int once | |
| ONCE | back to summary |
|---|---|
pack-priv static final AtomicIntegerFieldUpdater<UnicastProcessor<T>> ONCE
| |
| onOverflow | back to summary |
|---|---|
| pack-priv final Consumer<? super T> onOverflow | |
| onTerminate | back to summary |
|---|---|
| pack-priv volatile Disposable onTerminate | |
| outputFused | back to summary |
|---|---|
| pack-priv boolean outputFused | |
| queue | back to summary |
|---|---|
| pack-priv final Queue<T> queue | |
| requested | back to summary |
|---|---|
| pack-priv volatile long requested | |
| REQUESTED | back to summary |
|---|---|
pack-priv static final AtomicLongFieldUpdater<UnicastProcessor<T>> REQUESTED
| |
| wip | back to summary |
|---|---|
| pack-priv volatile int wip | |
| WIP | back to summary |
|---|---|
pack-priv static final AtomicIntegerFieldUpdater<UnicastProcessor<T>> WIP
| |
| UnicastProcessor | back to summary |
|---|---|
| public UnicastProcessor(Queue<T> queue) | |
| UnicastProcessor | back to summary |
|---|---|
| public UnicastProcessor(Queue<T> queue, Disposable onTerminate) | |
| UnicastProcessor | back to summary |
|---|---|
| public UnicastProcessor(Queue<T> queue, Consumer<? super T> onOverflow, Disposable onTerminate)
Deprecated
| |
| actual | back to summary |
|---|---|
| public CoreSubscriber Implements reactor.
| |
| asFlux | back to summary |
|---|---|
| public Flux Implements reactor. Doc from reactor. Return a
| |
| cancel | back to summary |
|---|---|
| public void cancel() Implements org. Doc from org. Request the Data may still be sent to meet previously signalled demand after calling cancel.
| |
| checkTerminated | back to summary |
|---|---|
| pack-priv boolean checkTerminated(boolean d, boolean empty, CoreSubscriber<? super T> a, Queue<T> q, T t) | |
| clear | back to summary |
|---|---|
| public void clear() Implements java. Doc from java. Removes all of the elements from this collection (optional operation). The collection will be empty after this method returns.
| |
| create | back to summary |
|---|---|
| public static <E> UnicastProcessor Deprecated use Create a new
| |
| create | back to summary |
|---|---|
| public static <E> UnicastProcessor Deprecated use Create a new
| |
| create | back to summary |
|---|---|
| public static <E> UnicastProcessor Deprecated use Create a new
| |
| create | back to summary |
|---|---|
| public static <E> UnicastProcessor Deprecated use Create a new
| |
| currentContext | back to summary |
|---|---|
| public Context currentContext() Overrides reactor. Overrides default reactor. Implements reactor. Doc from reactor. Request a
| |
| currentSubscriberCount | back to summary |
|---|---|
| public int currentSubscriberCount() Implements reactor. Doc from reactor. Get how many
This is a best effort peek at the sink state, and a subsequent attempt at emitting
to the sink might still return
| |
| doTerminate | back to summary |
|---|---|
| pack-priv void doTerminate() | |
| downstreamCount | back to summary |
|---|---|
| public long downstreamCount() Overrides reactor. Doc from reactor. Return the number of active
| |
| drain | back to summary |
|---|---|
| pack-priv void drain(T dataSignalOfferedBeforeDrain) | |
| drainFused | back to summary |
|---|---|
| pack-priv void drainFused(CoreSubscriber<? super T> a) | |
| drainRegular | back to summary |
|---|---|
| pack-priv void drainRegular(CoreSubscriber<? super T> a) | |
| emitNext | back to summary |
|---|---|
| public void emitNext(T value, Sinks. Overrides default reactor. Doc from reactor. A simplified attempt at emitting a non-null element via the
Generally,
When the
Might throw an unchecked exception as a last resort (eg. in case of a fatal error downstream which cannot
be propagated to any asynchronous handler, a bubbling exception, a
| |
| getBufferSize | back to summary |
|---|---|
| public int getBufferSize() Overrides reactor. Doc from reactor. Return the processor buffer capacity if any or
| |
| getError | back to summary |
|---|---|
| public Throwable getError() Overrides reactor. Doc from reactor. Current error if any, default to null | |
| getPrefetch | back to summary |
|---|---|
| public int getPrefetch() Overrides reactor. Doc from reactor. The prefetch configuration of the | |
| hasDownstreams | back to summary |
|---|---|
| public boolean hasDownstreams() Overrides reactor. Doc from reactor. Return true if any
| |
| inners | back to summary |
|---|---|
| public Stream Overrides reactor. Overrides default reactor. Doc from reactor. Return a | |
| isDisposed | back to summary |
|---|---|
| public boolean isDisposed() Overrides default reactor. Doc from reactor. 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.
| |
| isEmpty | back to summary |
|---|---|
| public boolean isEmpty() Implements java. Doc from java. Returns
| |
| isIdentityProcessor | back to summary |
|---|---|
| protected boolean isIdentityProcessor() Overrides reactor. Doc from reactor. Return true if
| |
| isTerminated | back to summary |
|---|---|
| public boolean isTerminated() Overrides reactor. Doc from reactor. Has this upstream finished or "completed" / "failed" ?
| |
| onComplete | back to summary |
|---|---|
| public void onComplete() Implements org. Doc from org. Successful terminal state.
No further events will be sent even if
| |
| onError | back to summary |
|---|---|
| public void onError(Throwable throwable) Implements org. Doc from org. Failed terminal state.
No further events will be sent even if | |
| onNext | back to summary |
|---|---|
| public void onNext(T t) Implements org. Doc from org. Data notification sent by the
| |
| onSubscribe | back to summary |
|---|---|
| public void onSubscribe(Subscription s) Implements reactor. Doc from reactor. Implementors should initialize any state used by
Note that an invalid request
No data will start flowing until
It is the responsibility of this
The
| |
| poll | back to summary |
|---|---|
| public T poll() Implements java. Doc from java. Retrieves and removes the head of this queue,
or returns | |
| request | back to summary |
|---|---|
| public void request(long n) Implements org. Doc from org. No events will be sent by a
It can be called however often and whenever needed—but if the outstanding cumulative demand ever becomes Long.MAX_VALUE or more,
it may be treated by the
Whatever has been requested can be sent by the
A | |
| requestFusion | back to summary |
|---|---|
| public int requestFusion(int requestedMode) Implements reactor. Doc from reactor. Request a specific fusion mode from this QueueSubscription. One should request either SYNC, ASYNC or ANY modes (never NONE) and the implementor should return NONE, SYNC or ASYNC (never ANY). For example, if a source supports only ASYNC fusion but the intermediate operator supports only SYNC fuseable sources, the operator may request SYNC fusion and the source can reject it via NONE, thus the operator can return NONE as well to downstream and the fusion doesn't happen.
| |
| scanUnsafe | back to summary |
|---|---|
| public Object scanUnsafe(Scannable. Overrides reactor. Overrides default reactor. Implements reactor. Doc from reactor. 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
For public consumption of attributes, prefer using | |
| size | back to summary |
|---|---|
| public int size() Implements java. Doc from java. Returns the number of elements in this collection. If this collection
contains more than
| |
| subscribe | back to summary |
|---|---|
| public void subscribe(CoreSubscriber<? super T> actual) Implements abstract reactor. Implements reactor. Doc from reactor. An internal
In addition to behave as expected by
| |
| tryEmitComplete | back to summary |
|---|---|
| public Sinks. Implements reactor. Doc from reactor. Try to terminate the sequence successfully, generating an
See the list of failure
| |
| tryEmitError | back to summary |
|---|---|
| public Sinks. Implements reactor. Doc from reactor. Try to fail the sequence, generating an
See the list of failure
| |
| tryEmitNext | back to summary |
|---|---|
| public Sinks. Implements reactor. Doc from reactor. Try emitting a non-null element, generating an
See the list of failure Might throw an unchecked exception as a last resort (eg. in case of a fatal error downstream which cannot be propagated to any asynchronous handler, a bubbling exception, ...).
| |