T - the value type
S - the per-subscriber user-defined state type
public static final class AbstractOnSubscribe.SubscriptionState<T,S> extends Object
AbstractOnSubscribe operation. It supports phasing and counts the number of times a value was requested by the downstream.
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
accept()
Emits the
onNext and/or the terminal value to the actual subscriber.
|
void |
advancePhase()
Advance the current phase by 1.
|
void |
advancePhaseBy(int amount)
Advance the current phase by the given amount (can be negative).
|
long |
calls()
|
protected void |
free()
Release the state if there are no more interest in it and it is not in use.
|
void |
onCompleted()
Call this method to send an
onCompleted to the subscriber and terminate all further activities.
|
void |
onError(Throwable
Call this method to send an
onError to the subscriber and terminate all further activities.
|
void |
onNext(T value)
Call this method to offer the next
onNext value for the subscriber.
|
int |
phase()
|
void |
phase(int newPhase)
Sets a new phase value.
|
S |
state()
|
void |
stop()
Signals that there won't be any further events.
|
protected boolean |
stopRequested()
|
protected void |
terminate()
Terminates the state immediately and calls
AbstractOnSubscribe with the custom state.
|
protected boolean |
use()
Request the state to be used by
onNext or returns
false if the downstream has unsubscribed.
|
protected boolean |
verify()
Verify if the
next() generated an event or requested a stop.
|
public S state()
AbstractOnSubscribe.onSubscribe(rx.Subscriber<? super T>)
public int phase()
public void phase(int newPhase)
newPhase -
public void advancePhase()
public void advancePhaseBy(int amount)
amount - the amount to advance the phase
public long calls()
AbstractOnSubscribe.next(rx.observables.AbstractOnSubscribe.SubscriptionState<T, S>) was called so far, starting at 0 for the very first call
public void onNext(T value)
onNext value for the subscriber.
value - the value to
onNext
IllegalStateException - if there is a value already offered but not taken or a terminal state is reached
public void onError(Throwablee)
onError to the subscriber and terminate all further activities. If there is a pending
onNext, that value is emitted to the subscriber followed by this exception.
e - the exception to deliver to the client
IllegalStateException - if the terminal state has been reached already
public void onCompleted()
onCompleted to the subscriber and terminate all further activities. If there is a pending
onNext, that value is emitted to the subscriber followed by this exception.
IllegalStateException - if the terminal state has been reached already
public void stop()
protected boolean accept()
onNext and/or the terminal value to the actual subscriber.
true if the event was a terminal event
protected boolean verify()
next() generated an event or requested a stop.
protected boolean stopRequested()
next() requested a stop
protected boolean use()
onNext or returns
false if the downstream has unsubscribed.
true if the state can be used exclusively
IllegalStateEception -
protected void free()
protected void terminate()
AbstractOnSubscribe.onTerminated(S) with the custom state.