Class MonoProcessor<O>
- Type Parameters:
O- the type of the value that will be made available
- All Implemented Interfaces:
Processor<O,,O> Publisher<O>,Subscriber<O>,Subscription,CorePublisher<O>,CoreSubscriber<O>,Disposable,Scannable
MonoProcessor is a Processor that is also a Mono.
Implementations might implements stateful semantics, allowing multiple subscriptions.
Once a MonoProcessor has been resolved, implementations may also replay cached signals to newer subscribers.
Despite having default implementations, most methods should be reimplemented with meaningful semantics relevant to concrete child classes.
- Author:
- Stephane Maldini
-
Nested Class Summary
Nested classes/interfaces inherited from interface reactor.core.Disposable
Disposable.Composite, Disposable.SwapNested classes/interfaces inherited from interface reactor.core.Scannable
Scannable.Attr<T> -
Field Summary
Fields inherited from interface reactor.core.Scannable
OPERATOR_NAME_UNRELATED_WORDS_PATTERN -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionblock()Deprecated.Block the calling thread indefinitely, waiting for the completion of thisMonoProcessor.Deprecated.Block the calling thread for the specified time, waiting for the completion of thisMonoProcessor.voidcancel()Deprecated.theMonoProcessorwill cease to implementSubscriptionin 3.5static <T> MonoProcessor<T>create()Deprecated.UseSinks.one(), to be removed in 3.5Deprecated.Request aContextfrom dependent components which can include downstream operators during subscribing or a terminalSubscriber.voiddispose()Deprecated.Cancel or dispose the underlying task or resource.longDeprecated.Return the number of activeSubscriberor -1 if untracked.getError()Deprecated.Return the producedThrowableerror if any or nullfinal booleanDeprecated.Return true if anySubscriberis actively subscribedinners()Deprecated.Return aStreamof referenced inners (flatmap, multicast etc)booleanDeprecated.theMonoProcessorwill cease to implementSubscriptionand this method will be removed in 3.5booleanDeprecated.Optionally return true when the resource or task is disposed.final booleanisError()Deprecated.Indicates whether thisMonoProcessorhas been completed with an error.final booleanDeprecated.Indicates whether thisMonoProcessorhas been successfully completed a value.booleanDeprecated.Indicates whether thisMonoProcessorhas been terminated by the source producer with a success or an error.peek()Deprecated.this method is discouraged, consider peeking into a MonoProcessor byturning it into a CompletableFuturevoidrequest(long n) Deprecated.theMonoProcessorwill cease to implementSubscriptionin 3.5scanUnsafe(Scannable.Attr key) Deprecated.This method is used internally by components to define their key-value mappings in a single place.Methods inherited from class reactor.core.publisher.Mono
and, as, blockOptional, blockOptional, cache, cache, cache, cache, cache, cacheInvalidateIf, cacheInvalidateWhen, cacheInvalidateWhen, cancelOn, cast, checkpoint, checkpoint, checkpoint, concatWith, contextCapture, contextWrite, contextWrite, create, defaultIfEmpty, defer, deferContextual, delay, delay, delayElement, delayElement, delaySubscription, delaySubscription, delaySubscription, delayUntil, dematerialize, doAfterTerminate, doFinally, doFirst, doOnCancel, doOnDiscard, doOnEach, doOnError, doOnError, doOnError, doOnNext, doOnRequest, doOnSubscribe, doOnSuccess, doOnTerminate, elapsed, elapsed, empty, error, error, expand, expand, expandDeep, expandDeep, filter, filterWhen, first, first, firstWithSignal, firstWithSignal, firstWithValue, firstWithValue, flatMap, flatMapIterable, flatMapMany, flatMapMany, flux, from, fromCallable, fromCompletionStage, fromCompletionStage, fromDirect, fromFuture, fromFuture, fromFuture, fromFuture, fromRunnable, fromSupplier, handle, hasElement, hide, ignoreElement, ignoreElements, just, justOrEmpty, justOrEmpty, log, log, log, log, log, log, map, mapNotNull, materialize, mergeWith, metrics, name, never, ofType, onAssembly, onErrorComplete, onErrorComplete, onErrorComplete, onErrorContinue, onErrorContinue, onErrorContinue, onErrorMap, onErrorMap, onErrorMap, onErrorResume, onErrorResume, onErrorResume, onErrorReturn, onErrorReturn, onErrorReturn, onErrorStop, onTerminateDetach, or, publish, publishOn, repeat, repeat, repeat, repeat, repeatWhen, repeatWhenEmpty, repeatWhenEmpty, retry, retry, retryWhen, sequenceEqual, sequenceEqual, sequenceEqual, share, single, singleOptional, subscribe, subscribe, subscribe, subscribe, subscribe, subscribe, subscribe, subscribe, subscribeOn, subscribeWith, switchIfEmpty, tag, take, take, takeUntilOther, tap, tap, tap, then, then, thenEmpty, thenMany, thenReturn, timed, timed, timeout, timeout, timeout, timeout, timeout, timeout, timestamp, timestamp, toFuture, toString, transform, transformDeferred, transformDeferredContextual, using, using, using, using, usingWhen, usingWhen, when, when, whenDelayError, whenDelayError, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zipDelayError, zipDelayError, zipDelayError, zipDelayError, zipDelayError, zipDelayError, zipDelayError, zipDelayError, zipDelayError, zipWhen, zipWhen, zipWith, zipWithMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface reactor.core.CoreSubscriber
onSubscribeMethods inherited from interface reactor.core.Scannable
actuals, isScanAvailable, name, parents, scan, scanOrDefault, stepName, steps, tags, tagsDeduplicatedMethods inherited from interface org.reactivestreams.Subscriber
onComplete, onError, onNext
-
Constructor Details
-
MonoProcessor
public MonoProcessor()Deprecated.
-
-
Method Details
-
create
Deprecated.UseSinks.one(), to be removed in 3.5Create aMonoProcessorthat will eagerly request 1 onSubscriber.onSubscribe(Subscription), cache and emit the eventual result for 1 or N subscribers.- Type Parameters:
T- type of the expected value- Returns:
- A
MonoProcessor.
-
cancel
Deprecated.theMonoProcessorwill cease to implementSubscriptionin 3.5- Specified by:
cancelin interfaceSubscription
-
isCancelled
Deprecated.theMonoProcessorwill cease to implementSubscriptionand this method will be removed in 3.5Indicates whether thisMonoProcessorhas been interrupted via cancellation.- Returns:
trueif thisMonoProcessoris cancelled,falseotherwise.
-
request
Deprecated.theMonoProcessorwill cease to implementSubscriptionin 3.5- Specified by:
requestin interfaceSubscription- Parameters:
n- the request amount
-
dispose
public void dispose()Deprecated.Description copied from interface:DisposableCancel or dispose the underlying task or resource.Implementations are required to make this method idempotent.
- Specified by:
disposein interfaceDisposable
-
block
Deprecated.Block the calling thread indefinitely, waiting for the completion of thisMonoProcessor. If theMonoProcessoris completed with an error a RuntimeException that wraps the error is thrown. -
block
Deprecated.Block the calling thread for the specified time, waiting for the completion of thisMonoProcessor. If theMonoProcessoris completed with an error a RuntimeException that wraps the error is thrown. -
getError
Deprecated.Return the producedThrowableerror if any or null- Returns:
- the produced
Throwableerror if any or null
-
isError
public final boolean isError()Deprecated.Indicates whether thisMonoProcessorhas been completed with an error.- Returns:
trueif thisMonoProcessorwas completed with an error,falseotherwise.
-
isSuccess
public final boolean isSuccess()Deprecated.Indicates whether thisMonoProcessorhas been successfully completed a value.- Returns:
trueif thisMonoProcessoris successful,falseotherwise.
-
isTerminated
public boolean isTerminated()Deprecated.Indicates whether thisMonoProcessorhas been terminated by the source producer with a success or an error.- Returns:
trueif thisMonoProcessoris successful,falseotherwise.
-
isDisposed
public boolean isDisposed()Deprecated.Description copied from interface:DisposableOptionally 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.
- Specified by:
isDisposedin interfaceDisposable- Returns:
- true when there's a guarantee the resource or task is disposed.
-
peek
Deprecated.this method is discouraged, consider peeking into a MonoProcessor byturning it into a CompletableFutureReturns the value that completed thisMonoProcessor. Returnsnullif theMonoProcessorhas not been completed. If theMonoProcessoris completed with an error a RuntimeException that wraps the error is thrown.- Returns:
- the value that completed the
MonoProcessor, ornullif it has not been completed - Throws:
RuntimeException- if theMonoProcessorwas completed with an error
-
currentContext
Deprecated.Description copied from interface:CoreSubscriberRequest aContextfrom dependent components which can include downstream operators during subscribing or a terminalSubscriber.- Specified by:
currentContextin interfaceCoreSubscriber<O>- Returns:
- a resolved context or
Context.empty()
-
scanUnsafe
Deprecated.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.
-
downstreamCount
public long downstreamCount()Deprecated.Return the number of activeSubscriberor -1 if untracked.- Returns:
- the number of active
Subscriberor -1 if untracked
-
hasDownstreams
public final boolean hasDownstreams()Deprecated.Return true if anySubscriberis actively subscribed- Returns:
- true if any
Subscriberis actively subscribed
-
inners
Deprecated.Description copied from interface:ScannableReturn aStreamof referenced inners (flatmap, multicast etc)
-
Sinks.OneorSinks.Emptyinstead, or see https://github.com/reactor/reactor-core/issues/2431 for alternatives