Class Operators.MonoSubscriber<I,O>
- Type Parameters:
I- The upstream sequence typeO- The downstream sequence type
- All Implemented Interfaces:
Iterable<O>,Collection<O>,Queue<O>,Subscriber<I>,Subscription,CoreSubscriber<I>,Fuseable,Fuseable.QueueSubscription<O>,Scannable
- Enclosing class:
- Operators
-
Nested Class Summary
Nested classes/interfaces inherited from interface reactor.core.Fuseable
Fuseable.ConditionalSubscriber<T>, Fuseable.QueueSubscription<T>, Fuseable.ScalarCallable<T>, Fuseable.SynchronousSubscription<T>Nested classes/interfaces inherited from interface reactor.core.Scannable
Scannable.Attr<T> -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final CoreSubscriber<? super O>The value stored by this Mono operator.Fields inherited from interface reactor.core.Fuseable.QueueSubscription
NOT_SUPPORTED_MESSAGEFields inherited from interface reactor.core.Scannable
OPERATOR_NAME_UNRELATED_WORDS_PATTERN -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal CoreSubscriber<? super O>actual()voidcancel()final voidclear()final voidTries to emit the value and complete the underlying subscriber or stores the value away until there is a request for it.default ContextRequest aContextfrom dependent components which can include downstream operators during subscribing or a terminalSubscriber.protected voidDiscard the given value, generally this.value field.final booleanReturns true if this Subscription has been cancelled.final booleanisEmpty()voidvoidvoidvoidImplementors should initialize any state used bySubscriber.onNext(Object)before callingSubscription.request(long).poll()voidrequest(long n) intrequestFusion(int mode) Request a specific fusion mode from this QueueSubscription.scanUnsafe(Scannable.Attr key) This method is used internally by components to define their key-value mappings in a single place.voidSet the value internally, without impacting request tracking state.intsize()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Collection
equals, hashCode, parallelStream, removeIf, spliterator, stream, toArrayMethods inherited from interface reactor.core.Fuseable.QueueSubscription
add, addAll, contains, containsAll, element, iterator, offer, peek, remove, remove, removeAll, retainAll, toArray, toArrayMethods inherited from interface reactor.core.Scannable
actuals, inners, isScanAvailable, name, parents, scan, scanOrDefault, stepName, steps, tags, tagsDeduplicated
-
Field Details
-
actual
-
value
The value stored by this Mono operator. Strongly prefer usingsetValue(Object)rather than direct writes to this field, when possible.
-
-
Constructor Details
-
MonoSubscriber
-
-
Method Details
-
cancel
public void cancel()- Specified by:
cancelin interfaceSubscription
-
scanUnsafe
Description copied from interface:ScannableThis method is used internally by components to define their key-value mappings in a single place. Although it is ignoring the generic type of theScannable.Attrkey, 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.- Specified by:
scanUnsafein interfaceScannable- Parameters:
key- aScannable.Attrto resolve for the component.- Returns:
- the value associated to the key for that specific component, or null if none.
-
clear
public final void clear()- Specified by:
clearin interfaceCollection<I>
-
complete
Tries to emit the value and complete the underlying subscriber or stores the value away until there is a request for it.Make sure this method is called at most once
- Parameters:
v- the value to emit
-
discard
Discard the given value, generally this.value field. Lets derived subscriber with further knowledge about the possible types of the value discard such values in a specific way. Note that fields should generally be nulled out along the discard call.- Parameters:
v- the value to discard
-
actual
-
isCancelled
public final boolean isCancelled()Returns true if this Subscription has been cancelled.- Returns:
- true if this Subscription has been cancelled
-
isEmpty
public final boolean isEmpty()- Specified by:
isEmptyin interfaceCollection<I>
-
onComplete
public void onComplete()- Specified by:
onCompletein interfaceSubscriber<I>
-
onError
- Specified by:
onErrorin interfaceSubscriber<I>
-
onNext
- Specified by:
onNextin interfaceSubscriber<I>
-
onSubscribe
Description copied from interface:CoreSubscriberImplementors should initialize any state used bySubscriber.onNext(Object)before callingSubscription.request(long). Should furtheronNextrelated state modification occur, thread-safety will be required.Note that an invalid request
<= 0will not produce an onError and will simply be ignored or reported through a debug-enabledLogger.- Specified by:
onSubscribein interfaceCoreSubscriber<I>- Specified by:
onSubscribein interfaceSubscriber<I>
-
poll
-
request
public void request(long n) - Specified by:
requestin interfaceSubscription
-
requestFusion
public int requestFusion(int mode) Description copied from interface:Fuseable.QueueSubscriptionRequest 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.
- Specified by:
requestFusionin interfaceFuseable.QueueSubscription<I>- Parameters:
mode- the mode requested by the intermediate operator- Returns:
- the actual fusion mode activated
-
setValue
Set the value internally, without impacting request tracking state. This however discards the provided value when detecting a cancellation.- Parameters:
value- the new value.- See Also:
-
size
public int size()- Specified by:
sizein interfaceCollection<I>
-
currentContext
Description copied from interface:CoreSubscriberRequest aContextfrom dependent components which can include downstream operators during subscribing or a terminalSubscriber.- Specified by:
currentContextin interfaceCoreSubscriber<I>- Returns:
- a resolved context or
Context.empty()
-