public interface Fuseable
Fuseable.QueueSubscription
.Modifier and Type | Interface and Description |
---|---|
static interface |
Fuseable.ConditionalSubscriber<T>
A subscriber variant that can immediately tell if it consumed
the value or not, directly allowing a new value to be sent if
it didn't.
|
static interface |
Fuseable.QueueSubscription<T>
Support contract for queue-fusion based optimizations on subscriptions.
|
static interface |
Fuseable.ScalarCallable<T>
Marker interface indicating that the target can return a value or null,
otherwise fail immediately and thus a viable target for assembly-time
optimizations.
|
static interface |
Fuseable.SynchronousSubscription<T>
Base class for synchronous sources which have fixed size and can
emit their items in a pull fashion, thus avoiding the request-accounting
overhead in many cases.
|
Modifier and Type | Field and Description |
---|---|
static int |
ANY
Indicates the QueueSubscription should decide what fusion it performs (input only).
|
static int |
ASYNC
Indicates the QueueSubscription can perform only async-fusion.
|
static int |
NONE
Indicates the QueueSubscription can't support the requested mode.
|
static int |
SYNC
Indicates the QueueSubscription can perform sync-fusion.
|
static int |
THREAD_BARRIER
Indicates that the queue will be drained from another thread
thus any queue-exit computation may be invalid at that point.
|
Modifier and Type | Method and Description |
---|---|
static String |
fusionModeName(int mode)
Attempt to convert a fusion mode int code into a human-readable representation.
|
static String |
fusionModeName(int mode,
boolean ignoreThreadBarrier)
Attempt to convert a fusion mode int code into a human-readable representation.
|
static final int NONE
static final int SYNC
static final int ASYNC
static final int ANY
static final int THREAD_BARRIER
For example, an asyncSource.map().publishOn().subscribe()
sequence where asyncSource
is async-fuseable: publishOn may fuse the whole sequence into a single Queue. That in turn
could invoke the mapper function from its poll()
method from another thread,
whereas the unfused sequence would have invoked the mapper on the previous thread.
If such mapper invocation is costly, it would escape its thread boundary this way.
static String fusionModeName(int mode)
THREAD_BARRIER
flag, as an appended +THREAD_BARRIER
.
This method accepts -1
as a special code, mainly for the benefit of supporting testing scenarios where
fusion can be entirely deactivated (returns Disabled
).
Other negative values and unknown positive codes on the other hand return Unknown(x)
.
Note that as this is a human-facing representation, the different values could evolve in the future. As such, never compare the returned string to a constant, but always use this method on both sides of a comparison.
mode
- the fusion mode int codeString
representation of the codestatic String fusionModeName(int mode, boolean ignoreThreadBarrier)
THREAD_BARRIER
flag, as an appended +THREAD_BARRIER
,
unless the ignoreThreadBarrier
parameter is set to true.
This method accepts -1
as a special code, mainly for the benefit of supporting testing scenarios where
fusion can be entirely deactivated (returns Disabled
).
Other negative values and unknown positive codes on the other hand return Unknown(x)
.
Note that as this is a human-facing representation, the different values could evolve in the future. As such, never compare the returned string to a constant, but always use this method on both sides of a comparison.
mode
- the fusion mode int codeignoreThreadBarrier
- whether or not to ignore the THREAD_BARRIER
flag in the representationString
representation of the code