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.Subscriber
that 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 void
onComplete()
Callback to signal completion of thePublisherSource
for thisSubscriber
.void
onError(java.lang.Throwable t)
Callback to receive anerror
for thisSubscriber
.void
onNext(T t)
Callback to receive adata
element for thisSubscriber
.void
onSubscribe(PublisherSource.Subscription subscription)
Callback to receive aPublisherSource.Subscription
for thisSubscriber
.boolean
processOnComplete()
Attempt to processonComplete()
.boolean
processOnError(java.lang.Throwable t)
Attempt to processonError(Throwable)
.
-
-
-
Constructor Detail
-
ConcurrentTerminalSubscriber
public ConcurrentTerminalSubscriber(PublisherSource.Subscriber<T> delegate)
Create a new instance.- Parameters:
delegate
- ThePublisherSource.Subscriber
to delegate all signals to.
-
ConcurrentTerminalSubscriber
public ConcurrentTerminalSubscriber(PublisherSource.Subscriber<T> delegate, boolean concurrentOnSubscribe)
Create a new instance.- Parameters:
delegate
- ThePublisherSource.Subscriber
to delegate all signals to.concurrentOnSubscribe
-false
to not guard for concurrency onPublisherSource.Subscriber.onSubscribe(PublisherSource.Subscription)
.true
means 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.Subscriber
Callback to receive aPublisherSource.Subscription
for thisSubscriber
.See Reactive Streams specifications for the rules about how and when this method will be invoked.
- Specified by:
onSubscribe
in interfacePublisherSource.Subscriber<T>
- Parameters:
subscription
-PublisherSource.Subscription
for thisSubscriber
.
-
onNext
public void onNext(@Nullable T t)
Description copied from interface:PublisherSource.Subscriber
Callback to receive adata
element for thisSubscriber
.See Reactive Streams specifications for the rules about how and when this method will be invoked.
- Specified by:
onNext
in interfacePublisherSource.Subscriber<T>
- Parameters:
t
- Adata
element.
-
onError
public void onError(java.lang.Throwable t)
Description copied from interface:PublisherSource.Subscriber
Callback to receive anerror
for thisSubscriber
.See Reactive Streams specifications for the rules about how and when this method will be invoked.
- Specified by:
onError
in interfacePublisherSource.Subscriber<T>
- Parameters:
t
-error
for thisSubscriber
.
-
processOnError
public boolean processOnError(java.lang.Throwable t)
Attempt to processonError(Throwable)
.- Parameters:
t
- The error to process.- Returns:
true
if the terminal signal was propagated to the delegatePublisherSource.Subscriber
.
-
onComplete
public void onComplete()
Description copied from interface:PublisherSource.Subscriber
Callback to signal completion of thePublisherSource
for thisSubscriber
.See Reactive Streams specifications for the rules about how and when this method will be invoked.
- Specified by:
onComplete
in interfacePublisherSource.Subscriber<T>
-
processOnComplete
public boolean processOnComplete()
Attempt to processonComplete()
.- Returns:
true
if the terminal signal was propagated to the delegatePublisherSource.Subscriber
.
-
-