public class SubscriberWithContext<T,C>
extends java.lang.Object
implements org.reactivestreams.Subscriber<T>
Subscriber with a typed stateful context. Some error isolation is also provided
(onSubscribe, onNext and onComplete error is forwarded to onError).| Modifier and Type | Field and Description |
|---|---|
protected C |
context |
protected org.reactivestreams.Subscriber<? super T> |
subscriber |
protected static java.util.concurrent.atomic.AtomicIntegerFieldUpdater<SubscriberWithContext> |
TERMINAL_UPDATER |
| Modifier | Constructor and Description |
|---|---|
protected |
SubscriberWithContext(C context,
org.reactivestreams.Subscriber<? super T> subscriber) |
| Modifier and Type | Method and Description |
|---|---|
C |
context()
The stateful context C
|
static <T,C> SubscriberWithContext<T,C> |
create(org.reactivestreams.Subscriber<? super T> subscriber,
C context)
Attach a given arbitrary context (stateful information) to a
Subscriber, all Subscriber methods
will delegate properly. |
boolean |
isCancelled() |
void |
onComplete() |
void |
onError(java.lang.Throwable t) |
void |
onNext(T t) |
void |
onSubscribe(org.reactivestreams.Subscription s) |
protected static final java.util.concurrent.atomic.AtomicIntegerFieldUpdater<SubscriberWithContext> TERMINAL_UPDATER
protected final C context
protected final org.reactivestreams.Subscriber<? super T> subscriber
public static <T,C> SubscriberWithContext<T,C> create(org.reactivestreams.Subscriber<? super T> subscriber, C context)
Subscriber, all Subscriber methods
will delegate properly.T - Type of data sequenceC - Type of attached stateful contextsubscriber - the delegate subscriber to invoke on signalcontext - the contextual state of any type to bind for later usepublic C context()
public void onSubscribe(org.reactivestreams.Subscription s)
onSubscribe in interface org.reactivestreams.Subscriber<T>public void onError(java.lang.Throwable t)
onError in interface org.reactivestreams.Subscriber<T>public void onComplete()
onComplete in interface org.reactivestreams.Subscriber<T>public boolean isCancelled()