Class DelegatingSignalOffloader
- java.lang.Object
-
- io.servicetalk.concurrent.internal.DelegatingSignalOffloader
-
- All Implemented Interfaces:
SignalOffloader
public class DelegatingSignalOffloader extends java.lang.Object implements SignalOffloader
ASignalOffloaderthat delegates all calls to anotherSignalOffloader.
-
-
Constructor Summary
Constructors Constructor Description DelegatingSignalOffloader(SignalOffloader delegate)Create a new instance.
-
Method Summary
All Methods Instance Methods Concrete 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.
-
-
-
Constructor Detail
-
DelegatingSignalOffloader
public DelegatingSignalOffloader(SignalOffloader delegate)
Create a new instance.- Parameters:
delegate-SignalOffloaderto delegate all calls.
-
-
Method Detail
-
offloadSubscriber
public <T> PublisherSource.Subscriber<? super T> offloadSubscriber(PublisherSource.Subscriber<? super T> subscriber)
Description copied from interface:SignalOffloaderDecorates 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.- Specified by:
offloadSubscriberin interfaceSignalOffloader- 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
public <T> SingleSource.Subscriber<? super T> offloadSubscriber(SingleSource.Subscriber<? super T> subscriber)
Description copied from interface:SignalOffloaderDecorates 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.- Specified by:
offloadSubscriberin interfaceSignalOffloader- 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
public CompletableSource.Subscriber offloadSubscriber(CompletableSource.Subscriber subscriber)
Description copied from interface:SignalOffloaderDecorates 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.- Specified by:
offloadSubscriberin interfaceSignalOffloader- Parameters:
subscriber-CompletableSource.Subscriberfor which the signals are to be offloaded.- Returns:
- New
CompletableSource.Subscriberthat will offload signals to the passedCompletableSource.Subscriber.
-
offloadSubscription
public <T> PublisherSource.Subscriber<? super T> offloadSubscription(PublisherSource.Subscriber<? super T> subscriber)
Description copied from interface:SignalOffloaderDecorates 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.- Specified by:
offloadSubscriptionin interfaceSignalOffloader- 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
public <T> SingleSource.Subscriber<? super T> offloadCancellable(SingleSource.Subscriber<? super T> subscriber)
Description copied from interface:SignalOffloaderDecorates 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.- Specified by:
offloadCancellablein interfaceSignalOffloader- 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
public CompletableSource.Subscriber offloadCancellable(CompletableSource.Subscriber subscriber)
Description copied from interface:SignalOffloaderDecorates 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.- Specified by:
offloadCancellablein interfaceSignalOffloader- Parameters:
subscriber-CompletableSource.Subscriberfor which the signals are to be offloaded.- Returns:
- New
CompletableSource.Subscriberthat will offload signals to the passedCompletableSource.Subscriber.
-
offloadSubscribe
public <T> void offloadSubscribe(PublisherSource.Subscriber<? super T> subscriber, java.util.function.Consumer<PublisherSource.Subscriber<? super T>> handleSubscribe)
Description copied from interface:SignalOffloaderOffloads 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.- Specified by:
offloadSubscribein interfaceSignalOffloader- 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
public <T> void offloadSubscribe(SingleSource.Subscriber<? super T> subscriber, java.util.function.Consumer<SingleSource.Subscriber<? super T>> handleSubscribe)
Description copied from interface:SignalOffloaderOffloads 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.- Specified by:
offloadSubscribein interfaceSignalOffloader- 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
public void offloadSubscribe(CompletableSource.Subscriber subscriber, java.util.function.Consumer<CompletableSource.Subscriber> handleSubscribe)
Description copied from interface:SignalOffloaderOffloads 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.- Specified by:
offloadSubscribein interfaceSignalOffloader- Parameters:
subscriber-PublisherSource.Subscriberfor which for which subscribe call has to be offloaded.handleSubscribe-Consumerto handle the offloaded subscribe call.
-
offloadSignal
public <T> void offloadSignal(T signal, java.util.function.Consumer<T> signalConsumer)Description copied from interface:SignalOffloaderOffloads 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.- Specified by:
offloadSignalin interfaceSignalOffloader- Type Parameters:
T- Type of signal.- Parameters:
signal-signalto send to theConsumer.signalConsumer-Consumerof the signal.
-
-