Interface SignalOffloader
-
- All Known Implementing Classes:
DelegatingSignalOffloader
public interface SignalOffloaderA contract to offload signals to and from any asynchronous source.Caution
ASignalOffloaderinstance MUST only be used for a single asynchronous execution chain at any given time. Reusing it across different execution chains concurrently may result in deadlock. Concurrent invocation of anySignalOffloadermethods may result in deadlock.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description CompletableSource.SubscriberoffloadCancellable(CompletableSource.Subscriber subscriber)Decorates the passedCompletableSource.Subscribersuch that all method calls to itsCancellablewill be offloaded.<T> SingleSource.Subscriber<? super T>offloadCancellable(SingleSource.Subscriber<? super T> subscriber)Decorates the passedSingleSource.Subscribersuch that all method calls to itsCancellablewill be offloaded.<T> voidoffloadSignal(T signal, java.util.function.Consumer<T> signalConsumer)Offloads the consumption of the passedsignalby the passedConsumer.voidoffloadSubscribe(CompletableSource.Subscriber subscriber, java.util.function.Consumer<CompletableSource.Subscriber> handleSubscribe)Offloads the subscribe call for the passedPublisherSource.Subscriber.<T> voidoffloadSubscribe(PublisherSource.Subscriber<? super T> subscriber, java.util.function.Consumer<PublisherSource.Subscriber<? super T>> handleSubscribe)Offloads subscribe call for the passedPublisherSource.Subscriber.<T> voidoffloadSubscribe(SingleSource.Subscriber<? super T> subscriber, java.util.function.Consumer<SingleSource.Subscriber<? super T>> handleSubscribe)Offloads subscribe call for the passedPublisherSource.Subscriber.CompletableSource.SubscriberoffloadSubscriber(CompletableSource.Subscriber subscriber)Decorates the passedCompletableSource.Subscribersuch that all method calls to it will be offloaded.<T> PublisherSource.Subscriber<? super T>offloadSubscriber(PublisherSource.Subscriber<? super T> subscriber)Decorates the passedPublisherSource.Subscribersuch that all method calls to it will be offloaded.<T> SingleSource.Subscriber<? super T>offloadSubscriber(SingleSource.Subscriber<? super T> subscriber)Decorates the passedSingleSource.Subscribersuch that all method calls to it will be offloaded.<T> PublisherSource.Subscriber<? super T>offloadSubscription(PublisherSource.Subscriber<? super T> subscriber)Decorates the passedPublisherSource.Subscribersuch that all method calls to itsPublisherSource.Subscriptionwill be offloaded.
-
-
-
Method Detail
-
offloadSubscriber
<T> PublisherSource.Subscriber<? super T> offloadSubscriber(PublisherSource.Subscriber<? super T> subscriber)
Decorates the passedPublisherSource.Subscribersuch that all method calls to it will be offloaded.Caution
This method MUST not be called concurrently with itself or other offload methods here on the sameSignalOffloaderinstance.- Type Parameters:
T- Type of items received by the passed and returnedPublisherSource.Subscriber.- Parameters:
subscriber-PublisherSource.Subscriberfor which the signals are to be offloaded.- Returns:
- New
PublisherSource.Subscriberthat will offload signals to the passedPublisherSource.Subscriber.
-
offloadSubscriber
<T> SingleSource.Subscriber<? super T> offloadSubscriber(SingleSource.Subscriber<? super T> subscriber)
Decorates the passedSingleSource.Subscribersuch that all method calls to it will be offloaded.Caution
This method MUST not be called concurrently with itself or other offload methods here on the sameSignalOffloaderinstance.- Type Parameters:
T- Type of items received by the passed and returnedSingleSource.Subscriber.- Parameters:
subscriber-SingleSource.Subscriberfor which the signals are to be offloaded.- Returns:
- New
SingleSource.Subscriberthat will offload signals to the passedSingleSource.Subscriber.
-
offloadSubscriber
CompletableSource.Subscriber offloadSubscriber(CompletableSource.Subscriber subscriber)
Decorates the passedCompletableSource.Subscribersuch that all method calls to it will be offloaded.Caution
This method MUST not be called concurrently with itself or other offload methods here on the sameSignalOffloaderinstance.- Parameters:
subscriber-CompletableSource.Subscriberfor which the signals are to be offloaded.- Returns:
- New
CompletableSource.Subscriberthat will offload signals to the passedCompletableSource.Subscriber.
-
offloadSubscription
<T> PublisherSource.Subscriber<? super T> offloadSubscription(PublisherSource.Subscriber<? super T> subscriber)
Decorates the passedPublisherSource.Subscribersuch that all method calls to itsPublisherSource.Subscriptionwill be offloaded. None of thePublisherSource.Subscribermethods will be offloaded.Caution
This method MUST not be called concurrently with itself or other offload methods here on the sameSignalOffloaderinstance.- Type Parameters:
T- Type of items received by the passed and returnedPublisherSource.Subscriber.- Parameters:
subscriber-PublisherSource.Subscriberfor which the signals are to be offloaded.- Returns:
- New
PublisherSource.Subscriberthat will offload signals to the passedPublisherSource.Subscriber.
-
offloadCancellable
<T> SingleSource.Subscriber<? super T> offloadCancellable(SingleSource.Subscriber<? super T> subscriber)
Decorates the passedSingleSource.Subscribersuch that all method calls to itsCancellablewill be offloaded. None of theSingleSource.Subscribermethods will be offloaded.Caution
This method MUST not be called concurrently with itself or other offload methods here on the sameSignalOffloaderinstance.- Type Parameters:
T- Type of items received by the passed and returnedSingleSource.Subscriber.- Parameters:
subscriber-SingleSource.Subscriberfor which the signals are to be offloaded.- Returns:
- New
SingleSource.Subscriberthat will offload signals to the passedSingleSource.Subscriber.
-
offloadCancellable
CompletableSource.Subscriber offloadCancellable(CompletableSource.Subscriber subscriber)
Decorates the passedCompletableSource.Subscribersuch that all method calls to itsCancellablewill be offloaded. None of theCompletableSource.Subscribermethods will be offloaded.Caution
LoadBalancerReadyHttpClientTest This method MUST not be called concurrently with itself or other offload methods here on the sameSignalOffloaderinstance.- Parameters:
subscriber-CompletableSource.Subscriberfor which the signals are to be offloaded.- Returns:
- New
CompletableSource.Subscriberthat will offload signals to the passedCompletableSource.Subscriber.
-
offloadSubscribe
<T> void offloadSubscribe(PublisherSource.Subscriber<? super T> subscriber, java.util.function.Consumer<PublisherSource.Subscriber<? super T>> handleSubscribe)
Offloads subscribe call for the passedPublisherSource.Subscriber.Offloading Failures
Implementations are expected to handle failure to offload, e.g. If a thread pool is used to offload and it rejects task submissions. In such situations, it is expected that the passedPublisherSource.Subscriberwill be correctly terminated.Caution
This method MUST not be called concurrently with itself or other offload methods here on the sameSignalOffloaderinstance.- Type Parameters:
T- Type of signal.- Parameters:
subscriber-PublisherSource.Subscriberfor which subscribe call has to be offloaded.handleSubscribe-Consumerto handle the offloaded subscribe call.
-
offloadSubscribe
<T> void offloadSubscribe(SingleSource.Subscriber<? super T> subscriber, java.util.function.Consumer<SingleSource.Subscriber<? super T>> handleSubscribe)
Offloads subscribe call for the passedPublisherSource.Subscriber.Offloading Failures
Implementations are expected to handle failure to offload, e.g. If a thread pool is used to offload and it rejects task submissions. In such situations, it is expected that the passedPublisherSource.Subscriberwill be correctly terminated.Caution
This method MUST not be called concurrently with itself or other offload methods here on the sameSignalOffloaderinstance.- Type Parameters:
T- Type of signal.- Parameters:
subscriber-SingleSource.Subscriberfor which subscribe call has to be offloaded.handleSubscribe-Consumerto handle the offloaded subscribe call.
-
offloadSubscribe
void offloadSubscribe(CompletableSource.Subscriber subscriber, java.util.function.Consumer<CompletableSource.Subscriber> handleSubscribe)
Offloads the subscribe call for the passedPublisherSource.Subscriber.Offloading Failures
Implementations are expected to handle failure to offload, e.g. If a thread pool is used to offload and it rejects task submissions. In such situations, it is expected that the passedPublisherSource.Subscriberwill be correctly terminated.Caution
This method MUST not be called concurrently with itself or other offload methods here on the sameSignalOffloaderinstance.- Parameters:
subscriber-PublisherSource.Subscriberfor which for which subscribe call has to be offloaded.handleSubscribe-Consumerto handle the offloaded subscribe call.
-
offloadSignal
<T> void offloadSignal(T signal, java.util.function.Consumer<T> signalConsumer)Offloads the consumption of the passedsignalby the passedConsumer.Caution
This method MUST not be called concurrently with itself or other offload methods here on the sameSignalOffloaderinstance.- Type Parameters:
T- Type of signal.- Parameters:
signal-signalto send to theConsumer.signalConsumer-Consumerof the signal.
-
-