T - the type of items expected to be observed by the Observer
Port from RxJava's SerializedObserver applied to Reactive Stream
public class SerializedSubscriber<T> extends java.lang.Object implements org.reactivestreams.Subscription, org.reactivestreams.Subscriber<T>, NonBlocking
onNext(T), onComplete(),
onError(java.lang.Throwable), request(long) and cancel().
When multiple threads are emitting and/or notifying they will be serialized by:
| Modifier and Type | Method and Description |
|---|---|
void |
cancel() |
static <T> SerializedSubscriber<T> |
create(org.reactivestreams.Subscriber<? super T> s) |
org.reactivestreams.Subscriber<? super T> |
delegate() |
long |
getCapacity()
Return defined element capacity, used to drive new
Subscription
request needs. |
boolean |
isReactivePull(Dispatcher dispatcher,
long producerCapacity)
Get the assigned
Dispatcher. |
void |
onComplete() |
void |
onError(java.lang.Throwable e) |
void |
onNext(T t) |
void |
onSubscribe(org.reactivestreams.Subscription s) |
void |
request(long n) |
java.lang.String |
toString() |
public static <T> SerializedSubscriber<T> create(org.reactivestreams.Subscriber<? super T> s)
public void onSubscribe(org.reactivestreams.Subscription s)
onSubscribe in interface org.reactivestreams.Subscriber<T>public void onComplete()
onComplete in interface org.reactivestreams.Subscriber<T>public void onError(java.lang.Throwable e)
onError in interface org.reactivestreams.Subscriber<T>public void request(long n)
request in interface org.reactivestreams.Subscriptionpublic void cancel()
cancel in interface org.reactivestreams.Subscriptionpublic org.reactivestreams.Subscriber<? super T> delegate()
public java.lang.String toString()
toString in class java.lang.Objectpublic boolean isReactivePull(Dispatcher dispatcher, long producerCapacity)
NonBlockingDispatcher.isReactivePull in interface NonBlockingpublic long getCapacity()
NonBlockingSubscription
request needs. This is the maximum in-flight data allowed to transit to this elements.getCapacity in interface NonBlocking