T
- the value typepublic class LambdaSubscriber<T> extends java.lang.Object implements BaseSubscriber<T>, Receiver, Cancellation, Completable, Backpressurable
Subscriber
Constructor and Description |
---|
LambdaSubscriber()
Create a
Subscriber to request Long.MAX_VALUE onSubscribe. |
LambdaSubscriber(java.util.function.Consumer<? super T> consumer,
java.util.function.Consumer<? super java.lang.Throwable> errorConsumer,
java.lang.Runnable completeConsumer)
Create a
Subscriber reacting onNext, onError and onComplete. |
Modifier and Type | Method and Description |
---|---|
protected void |
cancel() |
void |
dispose()
Cancel or dispose the underlying task or resource.
|
protected void |
doComplete() |
protected void |
doError(java.lang.Throwable t) |
protected void |
doNext(T x) |
protected void |
doSubscribe(org.reactivestreams.Subscription s) |
long |
getCapacity()
Return defined element capacity
|
long |
getPending()
Return current used space in buffer
|
boolean |
isStarted()
Has this upstream started or "onSubscribed" ?
|
boolean |
isTerminated()
Has this upstream finished or "completed" / "failed" ?
|
void |
onComplete() |
void |
onError(java.lang.Throwable t) |
void |
onNext(T x) |
void |
onSubscribe(org.reactivestreams.Subscription s) |
protected void |
requestMore(long n) |
java.lang.Object |
upstream()
Return the direct source of data, Supports reference.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
connect, connectEmitter, connectEmitter
public LambdaSubscriber()
Subscriber
to request Long.MAX_VALUE onSubscribe.public LambdaSubscriber(java.util.function.Consumer<? super T> consumer, java.util.function.Consumer<? super java.lang.Throwable> errorConsumer, java.lang.Runnable completeConsumer)
Subscriber
reacting onNext, onError and onComplete. The subscriber will automatically
request Long.MAX_VALUE onSubscribe.
The argument subscriptionHandler
is executed once by new subscriber to generate a context shared by
every
request calls.
consumer
- A Consumer
with argument onNext dataerrorConsumer
- A Consumer
called onErrorcompleteConsumer
- A Runnable
called onComplete with the actual context if anyprotected void doSubscribe(org.reactivestreams.Subscription s)
s
- public final void onSubscribe(org.reactivestreams.Subscription s)
onSubscribe
in interface org.reactivestreams.Subscriber<T>
onSubscribe
in interface BaseSubscriber<T>
public java.lang.Object upstream()
Receiver
public final void onComplete()
onComplete
in interface org.reactivestreams.Subscriber<T>
onComplete
in interface BaseSubscriber<T>
protected void doComplete()
public final void onError(java.lang.Throwable t)
onError
in interface org.reactivestreams.Subscriber<T>
onError
in interface BaseSubscriber<T>
protected void doError(java.lang.Throwable t)
t
- public final void onNext(T x)
onNext
in interface org.reactivestreams.Subscriber<T>
onNext
in interface BaseSubscriber<T>
protected void doNext(T x)
x
- protected void requestMore(long n)
n
- protected void cancel()
public long getPending()
Backpressurable
getPending
in interface Backpressurable
public long getCapacity()
Backpressurable
getCapacity
in interface Backpressurable
public boolean isStarted()
Completable
isStarted
in interface Completable
public boolean isTerminated()
Completable
isTerminated
in interface Completable
public void dispose()
Cancellation
Call to this method is/should be idempotent.
dispose
in interface Cancellation