T
- the value type returned by the SimpleQueue.poll()public interface QueueFuseable<T> extends SimpleQueue<T>
SimpleQueue
plus the means and constants for requesting a fusion mode.Modifier and Type | Field and Description |
---|---|
static int |
ANY
|
static int |
ASYNC
Request an asynchronous fusion mode and can be returned by
requestFusion(int)
for an accepted mode. |
static int |
BOUNDARY
Used in binary or combination with the other constants as an input to
requestFusion(int)
indicating that the SimpleQueue.poll() will be called behind an asynchronous boundary and thus
may change the non-trivial computation locations attached to the SimpleQueue.poll() chain of
fused operators. |
static int |
NONE
Returned by the
requestFusion(int) if the upstream doesn't support
the requested mode. |
static int |
SYNC
Request a synchronous fusion mode and can be returned by
requestFusion(int)
for an accepted mode. |
Modifier and Type | Method and Description |
---|---|
int |
requestFusion(int mode)
Request a fusion mode from the upstream.
|
static final int NONE
requestFusion(int)
if the upstream doesn't support
the requested mode.static final int SYNC
requestFusion(int)
for an accepted mode.
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 and callers of
SimpleQueue.poll()
should be prepared to catch exceptions. Note that SimpleQueue.poll()
has
to be called sequentially (from within a serializing drain-loop).
static final int ASYNC
requestFusion(int)
for an accepted mode.
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. Note that SimpleQueue.poll()
has to be called sequentially
(from within a serializing drain-loop). In addition, callers of SimpleQueue.poll()
should be
prepared to catch exceptions.
static final int ANY
static final int BOUNDARY
requestFusion(int)
indicating that the SimpleQueue.poll()
will be called behind an asynchronous boundary and thus
may change the non-trivial computation locations attached to the SimpleQueue.poll()
chain of
fused operators.
For example, fusing map() and observeOn() may move the computation of the map's function over to the thread run after the observeOn(), which is generally unexpected.