T
- the value typepublic final class SerializedSubscriber<T> extends Object implements FlowableSubscriber<T>, Subscription
Subscriber.onNext(Object)
, Subscriber.onError(Throwable)
and
Subscriber.onComplete()
methods of another Subscriber
.
Note that onSubscribe(Subscription)
is not serialized in respect of the other methods so
make sure the onSubscribe
is called with a non-null
Subscription
before any of the other methods are called.
The implementation assumes that the actual Subscriber
's methods don't throw.
Constructor and Description |
---|
SerializedSubscriber(Subscriber<? super T> downstream)
Construct a
SerializedSubscriber by wrapping the given actual Subscriber . |
SerializedSubscriber(@NonNull Subscriber<? super T> actual,
boolean delayError)
Construct a
SerializedSubscriber by wrapping the given actual Subscriber and
optionally delaying the errors till all regular values have been emitted
from the internal buffer. |
Modifier and Type | Method and Description |
---|---|
void |
cancel() |
void |
onComplete() |
void |
onError(Throwable t) |
void |
onNext(T t) |
void |
onSubscribe(@NonNull Subscription s)
Implementors of this method should make sure everything that needs
to be visible in
Subscriber.onNext(Object) is established before
calling Subscription.request(long) . |
void |
request(long n) |
public SerializedSubscriber(Subscriber<? super T> downstream)
SerializedSubscriber
by wrapping the given actual Subscriber
.downstream
- the actual Subscriber
, not null (not verified)public SerializedSubscriber(@NonNull @NonNull Subscriber<? super T> actual, boolean delayError)
SerializedSubscriber
by wrapping the given actual Subscriber
and
optionally delaying the errors till all regular values have been emitted
from the internal buffer.actual
- the actual Subscriber
, not null
(not verified)delayError
- if true
, errors are emitted after regular values have been emittedpublic void onSubscribe(@NonNull @NonNull Subscription s)
FlowableSubscriber
Subscriber.onNext(Object)
is established before
calling Subscription.request(long)
. In practice this means
no initialization should happen after the request()
call and
additional behavior is thread safe in respect to onNext
.
onSubscribe
in interface FlowableSubscriber<T>
onSubscribe
in interface Subscriber<T>
public void onNext(@NonNull T t)
onNext
in interface Subscriber<T>
public void onError(Throwable t)
onError
in interface Subscriber<T>
public void onComplete()
onComplete
in interface Subscriber<T>
public void request(long n)
request
in interface Subscription
public void cancel()
cancel
in interface Subscription