Top Description Inners Fields Constructors Methods
reactor.core.publisher

pack-priv final Class MonoCreate<T>

extends Mono<T>
implements SourceProducer<T>
Class Inheritance
All Implemented Interfaces
reactor.core.publisher.SourceProducer, org.reactivestreams.Publisher, reactor.core.Scannable
Type Parameters
<T>
the value type
Imports
java.util.Objects, java.util.concurrent.atomic.AtomicBoolean, .AtomicIntegerFieldUpdater, .AtomicReferenceFieldUpdater, java.util.function.Consumer, .LongConsumer, reactor.core.CoreSubscriber, .Disposable, .Disposables, reactor.core.publisher.FluxCreate.SinkDisposable, reactor.util.annotation.Nullable, reactor.util.context.Context, .ContextView

Wraps the downstream Subscriber into a single emission object and calls the given callback to produce a signal (a)synchronously.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Field Summary

Modifier and TypeField and Description
pack-priv final Consumer<MonoSink<T>>
pack-priv static final Disposable
pack-priv static final Disposable
Inherited from reactor.core.publisher.Mono:
EQUALS_BIPREDICATE

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public Object
scanUnsafe(Scannable.Attr<T>
a Attr to resolve for the component.
key
)

Overrides default reactor.core.publisher.SourceProducer.scanUnsafe.

This method is used internally by components to define their key-value mappings in a single place.
public void
subscribe(CoreSubscriber<? super T>
the Subscriber interested into the published sequence
actual
)

Implements abstract reactor.core.publisher.Mono.subscribe.

Implements reactor.core.CorePublisher.subscribe.

An internal Publisher#subscribe(Subscriber) that will bypass Hooks#onLastOperator(Function) pointcut.
Inherited from reactor.core.publisher.Mono:
andasblockblockblockOptionalblockOptionalcachecachecachecachecachecacheInvalidateIfcacheInvalidateWhencacheInvalidateWhencancelOncastcheckpointcheckpointcheckpointconcatWithcontextCapturecontextWritecontextWritecreatedefaultIfEmptydeferdeferContextualdelaydelaydelayElementdelayElementdelaySubscriptiondelaySubscriptiondelaySubscriptiondelayUntildematerializedoAfterTerminatedoFinallydoFirstdoOnCanceldoOnDiscarddoOnEachdoOnErrordoOnErrordoOnErrordoOnNextdoOnRequestdoOnSignaldoOnSubscribedoOnSuccessdoOnTerminalSignaldoOnTerminateelapsedelapsedemptyemptyequalsBiPredicateerrorerrorexpandexpandexpandDeepexpandDeepfilterfilterWhenfirstfirstfirstWithSignalfirstWithSignalfirstWithValuefirstWithValueflatMapflatMapIterableflatMapManyflatMapManyfluxfromfromCallablefromCompletionStagefromCompletionStagefromDirectfromFuturefromFuturefromFuturefromFuturefromRunnablefromSupplierhandlehasElementhideignoreElementignoreElementsjustjustOrEmptyjustOrEmptyloglogloglogloglogmapmapNotNullmaterializemergeWithmetricsnameneverofTypeonAssemblyonErrorCompleteonErrorCompleteonErrorCompleteonErrorContinueonErrorContinueonErrorContinueonErrorMaponErrorMaponErrorMaponErrorResumeonErrorResumeonErrorResumeonErrorReturnonErrorReturnonErrorReturnonErrorStoponTerminateDetachorpublishpublishOnrepeatrepeatrepeatrepeatrepeatWhenrepeatWhenEmptyrepeatWhenEmptyretryretryretryWhensequenceEqualsequenceEqualsequenceEqualsharesinglesingleOptionalsubscribesubscribesubscribesubscribesubscribesubscribesubscribesubscribeOnsubscribeWithswitchIfEmptytagtaketaketakeUntilOthertaptaptapthenthenthenEmptythenManythenReturntimedtimedtimeouttimeouttimeouttimeouttimeouttimeouttimestamptimestamptoFuturetoStringtransformtransformDeferredtransformDeferredContextualusingusingusingWhenusingWhenwhenwhenwhenDelayErrorwhenDelayErrorwrapzipzipzipzipzipzipzipzipzipzipzipDelayErrorzipDelayErrorzipDelayErrorzipDelayErrorzipDelayErrorzipDelayErrorzipDelayErrorzipDelayErrorzipDelayErrorzipWhenzipWhenzipWithzipWith

Field Detail

callbackback to summary
pack-priv final Consumer<MonoSink<T>> callback
CANCELLEDback to summary
pack-priv static final Disposable CANCELLED
TERMINATEDback to summary
pack-priv static final Disposable TERMINATED

Constructor Detail

MonoCreateback to summary
pack-priv MonoCreate(Consumer<MonoSink<T>> callback)

Method Detail

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

Overrides default reactor.core.publisher.SourceProducer.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
subscribeback to summary
public void subscribe(CoreSubscriber<? super T> actual)

Implements abstract reactor.core.publisher.Mono.subscribe.

Implements reactor.core.CorePublisher.subscribe.

Doc from reactor.core.publisher.Mono.subscribe.

An internal Publisher#subscribe(Subscriber) that will bypass Hooks#onLastOperator(Function) pointcut.

In addition to behave as expected by Publisher#subscribe(Subscriber) in a controlled manner, it supports direct subscribe-time Context passing.

Parameters
actual:CoreSubscriber<? super T>

the Subscriber interested into the published sequence

Annotations
@Override
reactor.core.publisher back to summary

pack-priv final Class MonoCreate.DefaultMonoSink<T>

extends AtomicBoolean
implements MonoSink<T>, InnerProducer<T>
Class Inheritance
All Implemented Interfaces
reactor.core.publisher.InnerProducer, org.reactivestreams.Subscription, reactor.core.Scannable, reactor.core.publisher.MonoSink

Field Summary

Modifier and TypeField and Description
pack-priv final CoreSubscriber<? super T>
pack-priv volatile Disposable
pack-priv static final AtomicReferenceFieldUpdater<MonoCreate.DefaultMonoSink<T>, Disposable>
pack-priv static final int
pack-priv static final int
pack-priv static final int
pack-priv static final AtomicReferenceFieldUpdater<MonoCreate.DefaultMonoSink<T>, LongConsumer>
pack-priv volatile LongConsumer
pack-priv volatile int
pack-priv static final AtomicIntegerFieldUpdater<MonoCreate.DefaultMonoSink<T>>
pack-priv T

Constructor Summary

AccessConstructor and Description
pack-priv
DefaultMonoSink(CoreSubscriber<? super T> actual)

Method Summary

Modifier and TypeMethod and Description
public CoreSubscriber<? super T>
public void
cancel()

Implements org.reactivestreams.Subscription.cancel.

Request the Publisher to stop sending data and clean up resources.
public ContextView
contextView()

Overrides default reactor.core.publisher.MonoSink.contextView.

Return the current subscriber's context as a ContextView for inspection.
public Context
currentContext()

Implements reactor.core.publisher.MonoSink.currentContext.

Deprecated
Return the current subscriber Context.
pack-priv void
disposeResource(boolean isCancel)

public void
error(Throwable
the exception to complete with
e
)

Implements reactor.core.publisher.MonoSink.error.

Terminate with the given exception

Calling this method multiple times or after the other terminating methods is an unsupported operation.

pack-priv boolean
public MonoSink<T>
onCancel(Disposable
the Disposable to use as a callback
d
)

Implements reactor.core.publisher.MonoSink.onCancel.

Attach a Disposable as a callback for when this MonoSink is cancelled.
public MonoSink<T>
onDispose(Disposable
the Disposable to use as a callback
d
)

Implements reactor.core.publisher.MonoSink.onDispose.

Attach a Disposable as a callback for when this MonoSink is effectively disposed, that is it cannot be used anymore.
public MonoSink<T>
onRequest(LongConsumer
the consumer to invoke on request
consumer
)

Implements reactor.core.publisher.MonoSink.onRequest.

Attaches a LongConsumer to this MonoSink that will be notified of any request to this sink.
public void
request(long
the strictly positive number of elements to requests to the upstream Publisher
n
)

Implements org.reactivestreams.Subscription.request.

No events will be sent by a Publisher until demand is signaled via this method.
public Object
scanUnsafe(Scannable.Attr<T>
a Attr to resolve for the component.
key
)

Overrides default reactor.core.publisher.InnerProducer.scanUnsafe.

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

Implements reactor.core.publisher.MonoSink.success.

Complete without any value.
public void
success(T
the value to complete with
value
)

Implements reactor.core.publisher.MonoSink.success.

Complete this Mono with the given value.
public String
toString()

Overrides java.util.concurrent.atomic.AtomicBoolean.toString.

Returns the String representation of the current value.
Inherited from java.util.concurrent.atomic.AtomicBoolean:
compareAndExchangecompareAndExchangeAcquirecompareAndExchangeReleasecompareAndSetgetgetAcquiregetAndSetgetOpaquegetPlainlazySetsetsetOpaquesetPlainsetReleaseweakCompareAndSetweakCompareAndSetAcquireweakCompareAndSetPlainweakCompareAndSetReleaseweakCompareAndSetVolatile

Field Detail

actualback to summary
pack-priv final CoreSubscriber<? super T> actual
disposableback to summary
pack-priv volatile Disposable disposable
DISPOSABLEback to summary
pack-priv static final AtomicReferenceFieldUpdater<MonoCreate.DefaultMonoSink<T>, Disposable> DISPOSABLE
Annotations
@SuppressWarnings:rawtypes
HAS_REQUEST_HAS_VALUEback to summary
pack-priv static final int HAS_REQUEST_HAS_VALUE
HAS_REQUEST_NO_VALUEback to summary
pack-priv static final int HAS_REQUEST_NO_VALUE
NO_REQUEST_HAS_VALUEback to summary
pack-priv static final int NO_REQUEST_HAS_VALUE
REQUEST_CONSUMERback to summary
pack-priv static final AtomicReferenceFieldUpdater<MonoCreate.DefaultMonoSink<T>, LongConsumer> REQUEST_CONSUMER
Annotations
@SuppressWarnings:rawtypes
requestConsumerback to summary
pack-priv volatile LongConsumer requestConsumer
stateback to summary
pack-priv volatile int state
STATEback to summary
pack-priv static final AtomicIntegerFieldUpdater<MonoCreate.DefaultMonoSink<T>> STATE
Annotations
@SuppressWarnings:rawtypes
valueback to summary
pack-priv T value

Hides java.util.concurrent.atomic.AtomicBoolean.value.

Constructor Detail

DefaultMonoSinkback to summary
pack-priv DefaultMonoSink(CoreSubscriber<? super T> actual)

Method Detail

actualback to summary
public CoreSubscriber<? super T> actual()

Implements reactor.core.publisher.InnerProducer.actual.

Annotations
@Override
cancelback to summary
public void cancel()

Implements org.reactivestreams.Subscription.cancel.

Doc from org.reactivestreams.Subscription.cancel.

Request the Publisher to stop sending data and clean up resources.

Data may still be sent to meet previously signalled demand after calling cancel.

Annotations
@Override
contextViewback to summary
public ContextView contextView()

Overrides default reactor.core.publisher.MonoSink.contextView.

Doc from reactor.core.publisher.MonoSink.contextView.

Return the current subscriber's context as a ContextView for inspection.

Context can be enriched downstream via Mono#contextWrite(Function) operator or directly by a child subscriber overriding CoreSubscriber#currentContext().

Returns:ContextView

the current subscriber ContextView.

Annotations
@Override
currentContextback to summary
public Context currentContext()

Implements reactor.core.publisher.MonoSink.currentContext.

Doc from reactor.core.publisher.MonoSink.currentContext.

Deprecated

Return the current subscriber Context.

Context can be enriched via Mono#contextWrite(Function) operator or directly by a child subscriber overriding CoreSubscriber#currentContext()

Annotations
@Override
@Deprecated
disposeResourceback to summary
pack-priv void disposeResource(boolean isCancel)
errorback to summary
public void error(Throwable e)

Implements reactor.core.publisher.MonoSink.error.

Doc from reactor.core.publisher.MonoSink.error.

Terminate with the given exception

Calling this method multiple times or after the other terminating methods is an unsupported operation. It will discard the exception through the Hooks#onErrorDropped(Consumer) hook. This is to avoid complete and silent swallowing of the exception.

Parameters
e:Throwable

the exception to complete with

Annotations
@Override
isDisposedback to summary
pack-priv boolean isDisposed()
onCancelback to summary
public MonoSink<T> onCancel(Disposable d)

Implements reactor.core.publisher.MonoSink.onCancel.

Doc from reactor.core.publisher.MonoSink.onCancel.

Attach a Disposable as a callback for when this MonoSink is cancelled. At most one callback can be registered, and subsequent calls to this method will result in the immediate disposal of the extraneous Disposable.

The callback is only relevant when the downstream Subscription is cancelled.

Parameters
d:Disposable

the Disposable to use as a callback

Returns:MonoSink<T>

the MonoSink with a cancellation callback

Annotations
@Override
onDisposeback to summary
public MonoSink<T> onDispose(Disposable d)

Implements reactor.core.publisher.MonoSink.onDispose.

Doc from reactor.core.publisher.MonoSink.onDispose.

Attach a Disposable as a callback for when this MonoSink is effectively disposed, that is it cannot be used anymore. This includes both having played terminal signals (onComplete, onError) and having been cancelled (see onCancel(Disposable)). At most one callback can be registered, and subsequent calls to this method will result in the immediate disposal of the extraneous Disposable.

Note that the "dispose" term is used from the perspective of the sink. Not to be confused with Mono#subscribe()'s Disposable#dispose() method, which maps to disposing the Subscription (effectively, a Subscription#cancel() signal).

Parameters
d:Disposable

the Disposable to use as a callback

Returns:MonoSink<T>

the MonoSink with a callback invoked on any terminal signal or on cancellation

Annotations
@Override
onRequestback to summary
public MonoSink<T> onRequest(LongConsumer consumer)

Implements reactor.core.publisher.MonoSink.onRequest.

Doc from reactor.core.publisher.MonoSink.onRequest.

Attaches a LongConsumer to this MonoSink that will be notified of any request to this sink.

Parameters
consumer:LongConsumer

the consumer to invoke on request

Returns:MonoSink<T>

MonoSink with a consumer that is notified of requests

Annotations
@Override
requestback to summary
public void request(long n)

Implements org.reactivestreams.Subscription.request.

Doc from org.reactivestreams.Subscription.request.

No events will be sent by a Publisher until demand is signaled via this method.

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 Publisher as "effectively unbounded".

Whatever has been requested can be sent by the Publisher so only signal demand for what can be safely handled.

A Publisher can send less than is requested if the stream ends but then must emit either Subscriber#onError(Throwable) or Subscriber#onComplete().

Parameters
n:long

the strictly positive number of elements to requests to the upstream Publisher

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

Overrides default reactor.core.publisher.InnerProducer.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
successback to summary
public void success()

Implements reactor.core.publisher.MonoSink.success.

Doc from reactor.core.publisher.MonoSink.success.

Complete without any value.

Calling this method multiple times or after the other terminating methods has no effect.

Annotations
@Override
successback to summary
public void success(T value)

Implements reactor.core.publisher.MonoSink.success.

Doc from reactor.core.publisher.MonoSink.success.

Complete this Mono with the given value.

Calling this method multiple times or after the other terminating methods has no effect (the value is dropped). Calling this method with a null value will be silently accepted as a call to success() by standard implementations.

Parameters
value:T

the value to complete with

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.util.concurrent.atomic.AtomicBoolean.toString.

Doc from java.util.concurrent.atomic.AtomicBoolean.toString.

Returns the String representation of the current value.

Returns:String

the String representation of the current value

Annotations
@Override