T
- the received value type.public abstract class DisposableSubscriber<T> extends java.lang.Object implements FlowableSubscriber<T>, Disposable
Constructor and Description |
---|
DisposableSubscriber() |
Modifier and Type | Method and Description |
---|---|
protected void |
cancel()
Cancels the Subscription set via onSubscribe or makes sure a
Subscription set asynchronously (later) is cancelled immediately.
|
void |
dispose()
Dispose the resource, the operation should be idempotent.
|
boolean |
isDisposed()
Returns true if this resource has been disposed.
|
protected void |
onStart()
Called once the single upstream Subscription is set via onSubscribe.
|
void |
onSubscribe(org.reactivestreams.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) . |
protected void |
request(long n)
Requests the specified amount from the upstream if its Subscription is set via
onSubscribe already.
|
public final void onSubscribe(org.reactivestreams.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 org.reactivestreams.Subscriber<T>
protected void onStart()
protected final void request(long n)
Note that calling this method before a Subscription is set via onSubscribe leads to NullPointerException and meant to be called from inside onStart or onNext.
n
- the request amount, positiveprotected final void cancel()
This method is thread-safe and can be exposed as a public API.
public final boolean isDisposed()
Disposable
isDisposed
in interface Disposable
public final void dispose()
Disposable
dispose
in interface Disposable