Class ConcurrentTerminalSubscriber<T>
- java.lang.Object
-
- io.servicetalk.concurrent.internal.ConcurrentTerminalSubscriber<T>
-
- Type Parameters:
T- The type ofPublisherSource.Subscriber.
- All Implemented Interfaces:
PublisherSource.Subscriber<T>
public final class ConcurrentTerminalSubscriber<T> extends java.lang.Object implements PublisherSource.Subscriber<T>
APublisherSource.Subscriberthat allows for concurrent delivery of terminal events.
-
-
Constructor Summary
Constructors Constructor Description ConcurrentTerminalSubscriber(PublisherSource.Subscriber<T> delegate)Create a new instance.ConcurrentTerminalSubscriber(PublisherSource.Subscriber<T> delegate, boolean concurrentOnSubscribe)Create a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidonComplete()Callback to signal completion of thePublisherSourcefor thisSubscriber.voidonError(java.lang.Throwable t)Callback to receive anerrorfor thisSubscriber.voidonNext(T t)Callback to receive adataelement for thisSubscriber.voidonSubscribe(PublisherSource.Subscription subscription)Callback to receive aPublisherSource.Subscriptionfor thisSubscriber.booleanprocessOnComplete()Attempt to processonComplete().booleanprocessOnError(java.lang.Throwable t)Attempt to processonError(Throwable).
-
-
-
Constructor Detail
-
ConcurrentTerminalSubscriber
public ConcurrentTerminalSubscriber(PublisherSource.Subscriber<T> delegate)
Create a new instance.- Parameters:
delegate- ThePublisherSource.Subscriberto delegate all signals to.
-
ConcurrentTerminalSubscriber
public ConcurrentTerminalSubscriber(PublisherSource.Subscriber<T> delegate, boolean concurrentOnSubscribe)
Create a new instance.- Parameters:
delegate- ThePublisherSource.Subscriberto delegate all signals to.concurrentOnSubscribe-falseto not guard for concurrency onPublisherSource.Subscriber.onSubscribe(PublisherSource.Subscription).truemeans thatPublisherSource.Subscriber.onSubscribe(PublisherSource.Subscription)will be protected against concurrent invocation with terminal methods.
-
-
Method Detail
-
onSubscribe
public void onSubscribe(PublisherSource.Subscription subscription)
Description copied from interface:PublisherSource.SubscriberCallback to receive aPublisherSource.Subscriptionfor thisSubscriber.See Reactive Streams specifications for the rules about how and when this method will be invoked.
- Specified by:
onSubscribein interfacePublisherSource.Subscriber<T>- Parameters:
subscription-PublisherSource.Subscriptionfor thisSubscriber.
-
onNext
public void onNext(@Nullable T t)Description copied from interface:PublisherSource.SubscriberCallback to receive adataelement for thisSubscriber.See Reactive Streams specifications for the rules about how and when this method will be invoked.
- Specified by:
onNextin interfacePublisherSource.Subscriber<T>- Parameters:
t- Adataelement.
-
onError
public void onError(java.lang.Throwable t)
Description copied from interface:PublisherSource.SubscriberCallback to receive anerrorfor thisSubscriber.See Reactive Streams specifications for the rules about how and when this method will be invoked.
- Specified by:
onErrorin interfacePublisherSource.Subscriber<T>- Parameters:
t-errorfor thisSubscriber.
-
processOnError
public boolean processOnError(java.lang.Throwable t)
Attempt to processonError(Throwable).- Parameters:
t- The error to process.- Returns:
trueif the terminal signal was propagated to the delegatePublisherSource.Subscriber.
-
onComplete
public void onComplete()
Description copied from interface:PublisherSource.SubscriberCallback to signal completion of thePublisherSourcefor thisSubscriber.See Reactive Streams specifications for the rules about how and when this method will be invoked.
- Specified by:
onCompletein interfacePublisherSource.Subscriber<T>
-
processOnComplete
public boolean processOnComplete()
Attempt to processonComplete().- Returns:
trueif the terminal signal was propagated to the delegatePublisherSource.Subscriber.
-
-