Class DelegatingSignalOffloader
- java.lang.Object
-
- io.servicetalk.concurrent.internal.DelegatingSignalOffloader
-
- All Implemented Interfaces:
SignalOffloader
public class DelegatingSignalOffloader extends java.lang.Object implements SignalOffloader
ASignalOffloader
that 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.Subscriber
offloadCancellable(CompletableSource.Subscriber subscriber)
Decorates the passedCompletableSource.Subscriber
such that all method calls to itsCancellable
will be offloaded.<T> SingleSource.Subscriber<? super T>
offloadCancellable(SingleSource.Subscriber<? super T> subscriber)
Decorates the passedSingleSource.Subscriber
such that all method calls to itsCancellable
will be offloaded.<T> void
offloadSignal(T signal, java.util.function.Consumer<T> signalConsumer)
Offloads the consumption of the passedsignal
by the passedConsumer
.void
offloadSubscribe(CompletableSource.Subscriber subscriber, java.util.function.Consumer<CompletableSource.Subscriber> handleSubscribe)
Offloads the subscribe call for the passedPublisherSource.Subscriber
.<T> void
offloadSubscribe(PublisherSource.Subscriber<? super T> subscriber, java.util.function.Consumer<PublisherSource.Subscriber<? super T>> handleSubscribe)
Offloads subscribe call for the passedPublisherSource.Subscriber
.<T> void
offloadSubscribe(SingleSource.Subscriber<? super T> subscriber, java.util.function.Consumer<SingleSource.Subscriber<? super T>> handleSubscribe)
Offloads subscribe call for the passedPublisherSource.Subscriber
.CompletableSource.Subscriber
offloadSubscriber(CompletableSource.Subscriber subscriber)
Decorates the passedCompletableSource.Subscriber
such that all method calls to it will be offloaded.<T> PublisherSource.Subscriber<? super T>
offloadSubscriber(PublisherSource.Subscriber<? super T> subscriber)
Decorates the passedPublisherSource.Subscriber
such that all method calls to it will be offloaded.<T> SingleSource.Subscriber<? super T>
offloadSubscriber(SingleSource.Subscriber<? super T> subscriber)
Decorates the passedSingleSource.Subscriber
such that all method calls to it will be offloaded.<T> PublisherSource.Subscriber<? super T>
offloadSubscription(PublisherSource.Subscriber<? super T> subscriber)
Decorates the passedPublisherSource.Subscriber
such that all method calls to itsPublisherSource.Subscription
will be offloaded.
-
-
-
Constructor Detail
-
DelegatingSignalOffloader
public DelegatingSignalOffloader(SignalOffloader delegate)
Create a new instance.- Parameters:
delegate
-SignalOffloader
to delegate all calls.
-
-
Method Detail
-
offloadSubscriber
public <T> PublisherSource.Subscriber<? super T> offloadSubscriber(PublisherSource.Subscriber<? super T> subscriber)
Description copied from interface:SignalOffloader
Decorates the passedPublisherSource.Subscriber
such 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 sameSignalOffloader
instance.- Specified by:
offloadSubscriber
in interfaceSignalOffloader
- Type Parameters:
T
- Type of items received by the passed and returnedPublisherSource.Subscriber
.- Parameters:
subscriber
-PublisherSource.Subscriber
for which the signals are to be offloaded.- Returns:
- New
PublisherSource.Subscriber
that will offload signals to the passedPublisherSource.Subscriber
.
-
offloadSubscriber
public <T> SingleSource.Subscriber<? super T> offloadSubscriber(SingleSource.Subscriber<? super T> subscriber)
Description copied from interface:SignalOffloader
Decorates the passedSingleSource.Subscriber
such 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 sameSignalOffloader
instance.- Specified by:
offloadSubscriber
in interfaceSignalOffloader
- Type Parameters:
T
- Type of items received by the passed and returnedSingleSource.Subscriber
.- Parameters:
subscriber
-SingleSource.Subscriber
for which the signals are to be offloaded.- Returns:
- New
SingleSource.Subscriber
that will offload signals to the passedSingleSource.Subscriber
.
-
offloadSubscriber
public CompletableSource.Subscriber offloadSubscriber(CompletableSource.Subscriber subscriber)
Description copied from interface:SignalOffloader
Decorates the passedCompletableSource.Subscriber
such 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 sameSignalOffloader
instance.- Specified by:
offloadSubscriber
in interfaceSignalOffloader
- Parameters:
subscriber
-CompletableSource.Subscriber
for which the signals are to be offloaded.- Returns:
- New
CompletableSource.Subscriber
that will offload signals to the passedCompletableSource.Subscriber
.
-
offloadSubscription
public <T> PublisherSource.Subscriber<? super T> offloadSubscription(PublisherSource.Subscriber<? super T> subscriber)
Description copied from interface:SignalOffloader
Decorates the passedPublisherSource.Subscriber
such that all method calls to itsPublisherSource.Subscription
will be offloaded. None of thePublisherSource.Subscriber
methods will be offloaded.Caution
This method MUST not be called concurrently with itself or other offload methods here on the sameSignalOffloader
instance.- Specified by:
offloadSubscription
in interfaceSignalOffloader
- Type Parameters:
T
- Type of items received by the passed and returnedPublisherSource.Subscriber
.- Parameters:
subscriber
-PublisherSource.Subscriber
for which the signals are to be offloaded.- Returns:
- New
PublisherSource.Subscriber
that will offload signals to the passedPublisherSource.Subscriber
.
-
offloadCancellable
public <T> SingleSource.Subscriber<? super T> offloadCancellable(SingleSource.Subscriber<? super T> subscriber)
Description copied from interface:SignalOffloader
Decorates the passedSingleSource.Subscriber
such that all method calls to itsCancellable
will be offloaded. None of theSingleSource.Subscriber
methods will be offloaded.Caution
This method MUST not be called concurrently with itself or other offload methods here on the sameSignalOffloader
instance.- Specified by:
offloadCancellable
in interfaceSignalOffloader
- Type Parameters:
T
- Type of items received by the passed and returnedSingleSource.Subscriber
.- Parameters:
subscriber
-SingleSource.Subscriber
for which the signals are to be offloaded.- Returns:
- New
SingleSource.Subscriber
that will offload signals to the passedSingleSource.Subscriber
.
-
offloadCancellable
public CompletableSource.Subscriber offloadCancellable(CompletableSource.Subscriber subscriber)
Description copied from interface:SignalOffloader
Decorates the passedCompletableSource.Subscriber
such that all method calls to itsCancellable
will be offloaded. None of theCompletableSource.Subscriber
methods will be offloaded.Caution
LoadBalancerReadyHttpClientTest This method MUST not be called concurrently with itself or other offload methods here on the sameSignalOffloader
instance.- Specified by:
offloadCancellable
in interfaceSignalOffloader
- Parameters:
subscriber
-CompletableSource.Subscriber
for which the signals are to be offloaded.- Returns:
- New
CompletableSource.Subscriber
that 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:SignalOffloader
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.Subscriber
will be correctly terminated.Caution
This method MUST not be called concurrently with itself or other offload methods here on the sameSignalOffloader
instance.- Specified by:
offloadSubscribe
in interfaceSignalOffloader
- Type Parameters:
T
- Type of signal.- Parameters:
subscriber
-PublisherSource.Subscriber
for which subscribe call has to be offloaded.handleSubscribe
-Consumer
to 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:SignalOffloader
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.Subscriber
will be correctly terminated.Caution
This method MUST not be called concurrently with itself or other offload methods here on the sameSignalOffloader
instance.- Specified by:
offloadSubscribe
in interfaceSignalOffloader
- Type Parameters:
T
- Type of signal.- Parameters:
subscriber
-SingleSource.Subscriber
for which subscribe call has to be offloaded.handleSubscribe
-Consumer
to handle the offloaded subscribe call.
-
offloadSubscribe
public void offloadSubscribe(CompletableSource.Subscriber subscriber, java.util.function.Consumer<CompletableSource.Subscriber> handleSubscribe)
Description copied from interface:SignalOffloader
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.Subscriber
will be correctly terminated.Caution
This method MUST not be called concurrently with itself or other offload methods here on the sameSignalOffloader
instance.- Specified by:
offloadSubscribe
in interfaceSignalOffloader
- Parameters:
subscriber
-PublisherSource.Subscriber
for which for which subscribe call has to be offloaded.handleSubscribe
-Consumer
to handle the offloaded subscribe call.
-
offloadSignal
public <T> void offloadSignal(T signal, java.util.function.Consumer<T> signalConsumer)
Description copied from interface:SignalOffloader
Offloads the consumption of the passedsignal
by the passedConsumer
.Caution
This method MUST not be called concurrently with itself or other offload methods here on the sameSignalOffloader
instance.- Specified by:
offloadSignal
in interfaceSignalOffloader
- Type Parameters:
T
- Type of signal.- Parameters:
signal
-signal
to send to theConsumer
.signalConsumer
-Consumer
of the signal.
-
-