T
- the value type transmitted through the queuepublic interface QueueDisposable<T> extends QueueFuseable<T>, Disposable
Observable
base reactive type.
The negotiation happens in subscription time when the upstream
calls the onSubscribe
with an instance of this interface. The
downstream has then the obligation to call QueueFuseable.requestFusion(int)
with the appropriate mode before calling request()
.
In synchronous fusion, all upstream values are either already available or is generated
when SimpleQueue.poll()
is called synchronously. When the SimpleQueue.poll()
returns null,
that is the indication if a terminated stream. In this mode, the upstream won't call the onXXX methods.
In asynchronous fusion, upstream values may become available to SimpleQueue.poll()
eventually.
Upstream signals onError() and onComplete() as usual but onNext may not actually contain
the upstream value but have null
instead. Downstream should treat such onNext as indication
that SimpleQueue.poll()
can be called.
The general rules for consuming the Queue
interface:
SimpleQueue.poll()
has to be called sequentially (from within a serializing drain-loop).SimpleQueue.poll()
should be prepared to catch exceptions.SimpleQueue.poll()
, SimpleQueue.poll()
may return
null
even if a preceding SimpleQueue.isEmpty()
returned false.
Implementations should only allow calling the following methods and the rest of the
Queue
interface methods should throw UnsupportedOperationException
:
requestFusion
clear, isEmpty, offer, offer, poll
dispose, isDisposed
Copyright © 2019. All rights reserved.