I
- The upstream sequence typeO
- The downstream sequence typepublic static class Operators.MonoSubscriber<I,O> extends Object implements Fuseable, Fuseable.QueueSubscription<O>
Scannable.Attr<T>
Fuseable.ConditionalSubscriber<T>, Fuseable.QueueSubscription<T>, Fuseable.ScalarCallable<T>, Fuseable.SynchronousSubscription<T>
Modifier and Type | Field and Description |
---|---|
protected CoreSubscriber<? super O> |
actual |
protected O |
value |
OPERATOR_NAME_UNRELATED_WORDS_PATTERN
NOT_SUPPORTED_MESSAGE
Constructor and Description |
---|
MonoSubscriber(CoreSubscriber<? super O> actual) |
Modifier and Type | Method and Description |
---|---|
CoreSubscriber<? super O> |
actual() |
void |
cancel() |
void |
clear() |
void |
complete(O v)
Tries to emit the value and complete the underlying subscriber or
stores the value away until there is a request for it.
|
default Context |
currentContext()
Request a
Context from dependent components which can include downstream
operators during subscribing or a terminal Subscriber . |
protected void |
discard(O v)
Discard the given value, generally this.value field.
|
boolean |
isCancelled()
Returns true if this Subscription has been cancelled.
|
boolean |
isEmpty() |
void |
onComplete() |
void |
onError(Throwable t) |
void |
onNext(I t) |
void |
onSubscribe(Subscription s)
Implementors should initialize any state used by
Subscriber.onNext(Object) before
calling Subscription.request(long) . |
O |
poll() |
void |
request(long n) |
int |
requestFusion(int mode)
Request a specific fusion mode from this QueueSubscription.
|
Object |
scanUnsafe(Scannable.Attr key)
This method is used internally by components to define their key-value mappings
in a single place.
|
void |
setValue(O value)
Set the value internally, without impacting request tracking state.
|
int |
size() |
default String |
stepName()
Return a meaningful
String representation of this Scannable in
its chain of Scannable.parents() and Scannable.actuals() . |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
actuals, from, inners, isScanAvailable, name, parents, scan, scanOrDefault, steps, tags
add, addAll, contains, containsAll, element, iterator, offer, peek, remove, remove, removeAll, retainAll, toArray, toArray
equals, hashCode, parallelStream, removeIf, spliterator, stream
protected final CoreSubscriber<? super O> actual
protected O value
public MonoSubscriber(CoreSubscriber<? super O> actual)
public final CoreSubscriber<? super O> actual()
public void cancel()
cancel
in interface Subscription
public final void clear()
clear
in interface Collection<O>
public final void complete(O v)
Make sure this method is called at most once
v
- the value to emitprotected void discard(O v)
v
- the value to discardpublic final boolean isCancelled()
public final boolean isEmpty()
isEmpty
in interface Collection<O>
public void onComplete()
public void onError(Throwable t)
public void onNext(I t)
public void onSubscribe(Subscription s)
CoreSubscriber
Subscriber.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
Logger
.
public void request(long n)
request
in interface Subscription
public int requestFusion(int mode)
Fuseable.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.
requestFusion
in interface Fuseable.QueueSubscription<O>
mode
- the mode requested by the intermediate operator@Nullable public Object scanUnsafe(Scannable.Attr key)
Scannable
Scannable.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 Scannable.scan(Attr)
, which will
return a typed value and fall back to the key's default if the component didn't
define any mapping.
key
- a Scannable.Attr
to resolve for the component.public void setValue(O value)
value
- the new value.complete(Object)
public int size()
size
in interface Collection<O>
public Context currentContext()
CoreSubscriber
Context
from dependent components which can include downstream
operators during subscribing or a terminal Subscriber
.Context.empty()
public String stepName()
Scannable
String
representation of this Scannable
in
its chain of Scannable.parents()
and Scannable.actuals()
.