Top Description Inners Fields Constructors Methods
reactor.core.publisher

pack-priv final Class MonoUsingWhen<T, S>

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 streamed
<S>
the resource type
Imports
java.util.Objects, java.util.concurrent.Callable, java.util.function.BiFunction, .Function, org.reactivestreams.Publisher, .Subscriber, .Subscription, reactor.core.CoreSubscriber, .Exceptions, reactor.core.publisher.FluxUsingWhen.UsingWhenSubscriber, .Operators.DeferredSubscription, reactor.util.annotation.Nullable, reactor.util.context.Context

Uses a resource, generated by a Publisher for each individual Subscriber, while streaming the values from a Publisher derived from the same resource. Whenever the resulting sequence terminates, the relevant Function generates a "cleanup" Publisher that is invoked but doesn't change the content of the main sequence. Instead it just defers the termination (unless it errors, in which case the error suppresses the original termination signal).

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
pack-priv static class

Field Summary

Modifier and TypeField and Description
pack-priv final Function<? super S, ? extends Publisher<?>>
pack-priv final Function<? super S, ? extends Publisher<?>>
pack-priv final BiFunction<? super S, ? super Throwable, ? extends Publisher<?>>
pack-priv final Function<? super S, ? extends Mono<? extends T>>
pack-priv final Publisher<S>
Inherited from reactor.core.publisher.Mono:
EQUALS_BIPREDICATE

Constructor Summary

AccessConstructor and Description
pack-priv
MonoUsingWhen(Publisher<S> resourceSupplier, Function<? super S, ? extends Mono<? extends T>> resourceClosure, Function<? super S, ? extends Publisher<?>> asyncComplete, BiFunction<? super S, ? super Throwable, ? extends Publisher<?>> asyncError, Function<? super S, ? extends Publisher<?>> asyncCancel)

Method Summary

Modifier and TypeMethod and Description
private static <RESOURCE, T> Mono<? extends T>
deriveMonoFromResource(RESOURCE resource, Function<? super RESOURCE, ? extends Mono<? extends T>> resourceClosure)

private static <RESOURCE, T> MonoUsingWhen.MonoUsingWhenSubscriber<? super T, RESOURCE>
prepareSubscriberForResource(RESOURCE resource, CoreSubscriber<? super T> actual, Function<? super RESOURCE, ? extends Publisher<?>> asyncComplete, BiFunction<? super RESOURCE, ? super Throwable, ? extends Publisher<?>> asyncError, Function<? super RESOURCE, ? extends Publisher<?>> asyncCancel, Operators.DeferredSubscription arbiter)

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

asyncCancelback to summary
pack-priv final Function<? super S, ? extends Publisher<?>> asyncCancel
Annotations
@Nullable
asyncCompleteback to summary
pack-priv final Function<? super S, ? extends Publisher<?>> asyncComplete
asyncErrorback to summary
pack-priv final BiFunction<? super S, ? super Throwable, ? extends Publisher<?>> asyncError
resourceClosureback to summary
pack-priv final Function<? super S, ? extends Mono<? extends T>> resourceClosure
resourceSupplierback to summary
pack-priv final Publisher<S> resourceSupplier

Constructor Detail

MonoUsingWhenback to summary
pack-priv MonoUsingWhen(Publisher<S> resourceSupplier, Function<? super S, ? extends Mono<? extends T>> resourceClosure, Function<? super S, ? extends Publisher<?>> asyncComplete, BiFunction<? super S, ? super Throwable, ? extends Publisher<?>> asyncError, Function<? super S, ? extends Publisher<?>> asyncCancel)

Method Detail

deriveMonoFromResourceback to summary
private static <RESOURCE, T> Mono<? extends T> deriveMonoFromResource(RESOURCE resource, Function<? super RESOURCE, ? extends Mono<? extends T>> resourceClosure)
prepareSubscriberForResourceback to summary
private static <RESOURCE, T> MonoUsingWhen.MonoUsingWhenSubscriber<? super T, RESOURCE> prepareSubscriberForResource(RESOURCE resource, CoreSubscriber<? super T> actual, Function<? super RESOURCE, ? extends Publisher<?>> asyncComplete, BiFunction<? super RESOURCE, ? super Throwable, ? extends Publisher<?>> asyncError, Function<? super RESOURCE, ? extends Publisher<?>> asyncCancel, Operators.DeferredSubscription arbiter)
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
@SuppressWarnings:unchecked
reactor.core.publisher back to summary

pack-priv Class MonoUsingWhen.MonoUsingWhenSubscriber<T, S>

extends FluxUsingWhen.UsingWhenSubscriber<T, S>
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv T
Inherited from reactor.core.publisher.FluxUsingWhen.UsingWhenSubscriber:
actualarbiterasyncCancelasyncCompleteasyncErrorCALLBACK_APPLIEDcallbackAppliederrorresources

Constructor Summary

AccessConstructor and Description
pack-priv
MonoUsingWhenSubscriber(CoreSubscriber<? super T> actual, S resource, Function<? super S, ? extends Publisher<?>> asyncComplete, BiFunction<? super S, ? super Throwable, ? extends Publisher<?>> asyncError, Function<? super S, ? extends Publisher<?>> asyncCancel, Operators.DeferredSubscription arbiter)

Method Summary

Modifier and TypeMethod and Description
public void
public void
public void
onNext(T
the element signaled
value
)

Overrides reactor.core.publisher.FluxUsingWhen.UsingWhenSubscriber.onNext.

Implements org.reactivestreams.Subscriber.onNext.

Data notification sent by the Publisher in response to requests to Subscription#request(long).
Inherited from reactor.core.publisher.FluxUsingWhen.UsingWhenSubscriber:
actualcancelonCompleteonErroronSubscriberequestscanUnsafe

Field Detail

valueback to summary
pack-priv T value

Constructor Detail

MonoUsingWhenSubscriberback to summary
pack-priv MonoUsingWhenSubscriber(CoreSubscriber<? super T> actual, S resource, Function<? super S, ? extends Publisher<?>> asyncComplete, BiFunction<? super S, ? super Throwable, ? extends Publisher<?>> asyncError, Function<? super S, ? extends Publisher<?>> asyncCancel, Operators.DeferredSubscription arbiter)

Method Detail

deferredCompleteback to summary
public void deferredComplete()

Overrides reactor.core.publisher.FluxUsingWhen.UsingWhenSubscriber.deferredComplete.

Implements reactor.core.publisher.FluxUsingWhen.UsingWhenParent.deferredComplete.

Annotations
@Override
deferredErrorback to summary
public void deferredError(Throwable error)

Overrides reactor.core.publisher.FluxUsingWhen.UsingWhenSubscriber.deferredError.

Implements reactor.core.publisher.FluxUsingWhen.UsingWhenParent.deferredError.

Annotations
@Override
onNextback to summary
public void onNext(T value)

Overrides reactor.core.publisher.FluxUsingWhen.UsingWhenSubscriber.onNext.

Implements org.reactivestreams.Subscriber.onNext.

Doc from org.reactivestreams.Subscriber.onNext.

Data notification sent by the Publisher in response to requests to Subscription#request(long).

Parameters
value:T

the element signaled

Annotations
@Override
reactor.core.publisher back to summary

pack-priv Class MonoUsingWhen.ResourceSubscriber<S, T>

extends DeferredSubscription
implements InnerConsumer<S>
Class Inheritance
All Implemented Interfaces
reactor.core.publisher.InnerConsumer, reactor.core.Scannable, reactor.core.CoreSubscriber, org.reactivestreams.Subscriber

Field Summary

Modifier and TypeField and Description
pack-priv final CoreSubscriber<? super T>
pack-priv final Function<? super S, ? extends Publisher<?>>
pack-priv final Function<? super S, ? extends Publisher<?>>
pack-priv final BiFunction<? super S, ? super Throwable, ? extends Publisher<?>>
pack-priv final boolean
pack-priv final Function<? super S, ? extends Mono<? extends T>>
pack-priv boolean
pack-priv Subscription
Inherited from reactor.core.publisher.Operators.DeferredSubscription:
requestedREQUESTEDsSTATE_CANCELLEDSTATE_SUBSCRIBED

Constructor Summary

AccessConstructor and Description
pack-priv
ResourceSubscriber(CoreSubscriber<? super T> actual, Function<? super S, ? extends Mono<? extends T>> resourceClosure, Function<? super S, ? extends Publisher<?>> asyncComplete, BiFunction<? super S, ? super Throwable, ? extends Publisher<?>> asyncError, Function<? super S, ? extends Publisher<?>> asyncCancel, boolean isMonoSource)

Method Summary

Modifier and TypeMethod and Description
public void
cancel()

Overrides reactor.core.publisher.Operators.DeferredSubscription.cancel.

Implements org.reactivestreams.Subscription.cancel.

Request the Publisher to stop sending data and clean up resources.
public Context
currentContext()

Overrides default reactor.core.CoreSubscriber.currentContext.

Request a Context from dependent components which can include downstream operators during subscribing or a terminal org.reactivestreams.Subscriber.
public void
onComplete()

Implements org.reactivestreams.Subscriber.onComplete.

Successful terminal state.
public void
onError(Throwable
the throwable signaled
throwable
)

Implements org.reactivestreams.Subscriber.onError.

Failed terminal state.
public void
onNext(S
the element signaled
resource
)

Implements org.reactivestreams.Subscriber.onNext.

Data notification sent by the Publisher in response to requests to Subscription#request(long).
public void
onSubscribe(Subscription
the Subscription that allows requesting data via Subscription#request(long)
s
)

Implements reactor.core.CoreSubscriber.onSubscribe.

Implementors should initialize any state used by onNext(Object) before calling Subscription#request(long).
public Object
scanUnsafe(Scannable.Attr<T>
a Attr to resolve for the component.
key
)

Overrides reactor.core.publisher.Operators.DeferredSubscription.scanUnsafe.

Implements reactor.core.Scannable.scanUnsafe.

This method is used internally by components to define their key-value mappings in a single place.
Inherited from reactor.core.publisher.Operators.DeferredSubscription:
isCancelledrequestsetterminate

Field Detail

actualback to summary
pack-priv final CoreSubscriber<? super T> actual
asyncCancelback to summary
pack-priv final Function<? super S, ? extends Publisher<?>> asyncCancel
Annotations
@Nullable
asyncCompleteback to summary
pack-priv final Function<? super S, ? extends Publisher<?>> asyncComplete
asyncErrorback to summary
pack-priv final BiFunction<? super S, ? super Throwable, ? extends Publisher<?>> asyncError
isMonoSourceback to summary
pack-priv final boolean isMonoSource
resourceClosureback to summary
pack-priv final Function<? super S, ? extends Mono<? extends T>> resourceClosure
resourceProvidedback to summary
pack-priv boolean resourceProvided
resourceSubscriptionback to summary
pack-priv Subscription resourceSubscription

Constructor Detail

ResourceSubscriberback to summary
pack-priv ResourceSubscriber(CoreSubscriber<? super T> actual, Function<? super S, ? extends Mono<? extends T>> resourceClosure, Function<? super S, ? extends Publisher<?>> asyncComplete, BiFunction<? super S, ? super Throwable, ? extends Publisher<?>> asyncError, Function<? super S, ? extends Publisher<?>> asyncCancel, boolean isMonoSource)

Method Detail

cancelback to summary
public void cancel()

Overrides reactor.core.publisher.Operators.DeferredSubscription.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
currentContextback to summary
public Context currentContext()

Overrides default reactor.core.CoreSubscriber.currentContext.

Doc from reactor.core.CoreSubscriber.currentContext.

Request a Context from dependent components which can include downstream operators during subscribing or a terminal org.reactivestreams.Subscriber.

Returns:Context

a resolved context or Context#empty()

Annotations
@Override
onCompleteback to summary
public void onComplete()

Implements org.reactivestreams.Subscriber.onComplete.

Doc from org.reactivestreams.Subscriber.onComplete.

Successful terminal state.

No further events will be sent even if Subscription#request(long) is invoked again.

Annotations
@Override
onErrorback to summary
public void onError(Throwable throwable)

Implements org.reactivestreams.Subscriber.onError.

Doc from org.reactivestreams.Subscriber.onError.

Failed terminal state.

No further events will be sent even if Subscription#request(long) is invoked again.

Parameters
throwable:Throwable

the throwable signaled

Annotations
@Override
onNextback to summary
public void onNext(S resource)

Implements org.reactivestreams.Subscriber.onNext.

Doc from org.reactivestreams.Subscriber.onNext.

Data notification sent by the Publisher in response to requests to Subscription#request(long).

Parameters
resource:S

the element signaled

Annotations
@Override
onSubscribeback to summary
public void onSubscribe(Subscription s)

Implements reactor.core.CoreSubscriber.onSubscribe.

Doc from reactor.core.CoreSubscriber.onSubscribe.

Implementors should initialize any state used by 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 reactor.util.Logger. Invoked after calling Publisher#subscribe(Subscriber).

No data will start flowing until Subscription#request(long) is invoked.

It is the responsibility of this Subscriber instance to call Subscription#request(long) whenever more data is wanted.

The Publisher will send notifications only in response to Subscription#request(long).

Parameters
s:Subscription

Doc from org.reactivestreams.Subscriber.onSubscribe.

the Subscription that allows requesting data via Subscription#request(long)

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

Overrides reactor.core.publisher.Operators.DeferredSubscription.scanUnsafe.

Implements reactor.core.Scannable.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