T
- the received value type.public abstract class DisposableSubscriber<T> extends java.lang.Object implements org.reactivestreams.Subscriber<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) |
protected void |
request(long n)
Requests the specified amount from the upstream if its Subscription is set via
onSubscribe already.
|
protected org.reactivestreams.Subscription |
subscription()
Returns the current Subscription sent to this Subscriber via onSubscribe().
|
public final void onSubscribe(org.reactivestreams.Subscription s)
onSubscribe
in interface org.reactivestreams.Subscriber<T>
protected final org.reactivestreams.Subscription subscription()
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