public abstract class AsyncSubscriber<T> extends java.lang.Object implements Subscriber<T>, java.lang.Runnable
Modifier | Constructor and Description |
---|---|
protected |
AsyncSubscriber(java.util.concurrent.Executor executor) |
Modifier and Type | Method and Description |
---|---|
void |
onComplete()
Successful terminal state.
|
void |
onError(java.lang.Throwable t)
Failed terminal state.
|
void |
onNext(T element)
Data notification sent by the
Publisher in response to requests to Subscription.request(long) . |
void |
onSubscribe(Subscription s)
Invoked after calling
Publisher.subscribe(Subscriber) . |
void |
run() |
protected void |
whenComplete() |
protected void |
whenError(java.lang.Throwable error) |
protected abstract boolean |
whenNext(T element) |
protected AsyncSubscriber(java.util.concurrent.Executor executor)
protected abstract boolean whenNext(T element)
protected void whenComplete()
protected void whenError(java.lang.Throwable error)
public final void onSubscribe(Subscription s)
Subscriber
Publisher.subscribe(Subscriber)
.
No data will start flowing until Subscription.request(long)
is invoked.
It is the responsibility of this Subscriber
instance to call Subscription.request(long)
whenever more data is wanted.
The Publisher
will send notifications only in response to Subscription.request(long)
.
onSubscribe
in interface Subscriber<T>
s
- Subscription
that allows requesting data via Subscription.request(long)
public final void onNext(T element)
Subscriber
Publisher
in response to requests to Subscription.request(long)
.onNext
in interface Subscriber<T>
element
- the element signaledpublic final void onError(java.lang.Throwable t)
Subscriber
No further events will be sent even if Subscription.request(long)
is invoked again.
onError
in interface Subscriber<T>
t
- the throwable signaledpublic final void onComplete()
Subscriber
No further events will be sent even if Subscription.request(long)
is invoked again.
onComplete
in interface Subscriber<T>
public final void run()
run
in interface java.lang.Runnable