abstract class AbstractSubscription<TResult> extends java.lang.Object implements Subscription
| Modifier and Type | Field and Description |
|---|---|
private boolean |
isProcessing |
private boolean |
isTerminated |
private boolean |
isUnsubscribed |
private Observer<? super TResult> |
observer |
private long |
requested |
private boolean |
requestedData |
private java.util.concurrent.ConcurrentLinkedQueue<TResult> |
resultsQueue |
| Constructor and Description |
|---|
AbstractSubscription(Observer<? super TResult> observer) |
| Modifier and Type | Method and Description |
|---|---|
(package private) void |
addToQueue(java.util.List<TResult> results) |
(package private) void |
addToQueue(TResult result) |
(package private) abstract boolean |
checkCompleted() |
(package private) long |
getRequested() |
(package private) boolean |
isTerminated() |
boolean |
isUnsubscribed()
Indicates whether this
Subscription is currently unsubscribed. |
(package private) void |
onComplete() |
(package private) void |
onError(java.lang.Throwable t) |
(package private) void |
onNext(TResult next) |
(package private) void |
postTerminate() |
private void |
processResultsQueue() |
void |
request(long n)
No operation will be sent to MongoDB from the
Observable until demand is signaled via this method. |
(package private) abstract void |
requestInitialData() |
(package private) void |
requestMoreData() |
private boolean |
terminalAction() |
private void |
tryProcessResultsQueue() |
private void |
tryRequestInitialData() |
void |
unsubscribe()
Request the
Observable to stop sending data and clean up resources. |
private boolean requestedData
private boolean isProcessing
private long requested
private boolean isUnsubscribed
private boolean isTerminated
private final java.util.concurrent.ConcurrentLinkedQueue<TResult> resultsQueue
public void unsubscribe()
SubscriptionObservable to stop sending data and clean up resources.
As this request is asynchronous data may still be sent to meet previously signalled demand after calling cancel.
unsubscribe in interface Subscriptionpublic boolean isUnsubscribed()
SubscriptionSubscription is currently unsubscribed.isUnsubscribed in interface Subscriptiontrue if this Subscription is currently unsubscribed, false otherwisepublic void request(long n)
SubscriptionObservable until demand is signaled via this method.
It can be called however often and whenever needed, but the outstanding cumulative demand must never exceed Long.MAX_VALUE.
An outstanding cumulative demand of Long.MAX_VALUE may be treated by the Observable as "effectively unbounded".
Whatever has been requested might be sent, so only signal demand for what can be safely handled.
An Observable can send less than is requested if the stream ends but then must emit either
Observer.onError(Throwable) or Observer.onComplete().
request in interface Subscriptionn - the strictly positive number of elements to requests to the upstream Observableabstract void requestInitialData()
void requestMoreData()
void postTerminate()
abstract boolean checkCompleted()
boolean isTerminated()
long getRequested()
void addToQueue(TResult result)
void addToQueue(java.util.List<TResult> results)
void onError(java.lang.Throwable t)
void onNext(TResult next)
void onComplete()
private void tryRequestInitialData()
private void tryProcessResultsQueue()
private void processResultsQueue()
private boolean terminalAction()