T
- the value typepublic final class SafeSubscriber<T> extends Object implements FlowableSubscriber<T>, Subscription
Subscriber
and ensures all onXXX
methods conform the protocol
(except the requirement for serialized access).Constructor and Description |
---|
SafeSubscriber(@NonNull Subscriber<? super T> downstream)
Constructs a
SafeSubscriber by wrapping the given actual Subscriber . |
Modifier and Type | Method and Description |
---|---|
void |
cancel() |
void |
onComplete() |
void |
onError(@NonNull 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 SafeSubscriber(@NonNull @NonNull Subscriber<? super T> downstream)
SafeSubscriber
by wrapping the given actual Subscriber
.downstream
- the actual Subscriber
to wrap, not null
(not validated)public 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(@NonNull @NonNull 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