T
- the value type received and emittedpublic class DeferredScalarDisposable<T> extends BasicIntQueueDisposable<T>
Modifier and Type | Field and Description |
---|---|
protected Observer<? super T> |
actual
The target of the events.
|
protected T |
value
The value stored temporarily when in fusion mode.
|
Constructor and Description |
---|
DeferredScalarDisposable(Observer<? super T> actual)
Constructs a DeferredScalarDisposable by wrapping the Observer.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Removes all enqueued items from this queue.
|
void |
complete()
Complete the target without any value.
|
void |
complete(T value)
Complete the target with a single value or indicate there is a value available in
fusion mode.
|
void |
dispose()
Dispose the resource, the operation should be idempotent.
|
void |
error(Throwable t)
Complete the target with an error signal.
|
boolean |
isDisposed()
Returns true if this resource has been disposed.
|
boolean |
isEmpty()
Returns true if the queue is empty.
|
T |
poll()
Tries to dequeue a value (non-null) or returns null if
the queue is empty.
|
int |
requestFusion(int mode)
Request a fusion mode from the upstream.
|
boolean |
tryDispose()
Try disposing this Disposable and return true if the current thread succeeded.
|
offer, offer
accumulateAndGet, addAndGet, compareAndSet, decrementAndGet, doubleValue, floatValue, get, getAndAccumulate, getAndAdd, getAndDecrement, getAndIncrement, getAndSet, getAndUpdate, incrementAndGet, intValue, lazySet, longValue, set, toString, updateAndGet, weakCompareAndSet
byteValue, shortValue
protected T value
public final int requestFusion(int mode)
QueueFuseable
This should be called before onSubscribe
returns.
Calling this method multiple times or after onSubscribe
finished is not allowed
and may result in undefined behavior.
mode
- the requested fusion mode, allowed values are QueueFuseable.SYNC
, QueueFuseable.ASYNC
,
QueueFuseable.ANY
combined with QueueFuseable.BOUNDARY
(e.g., requestFusion(SYNC | BOUNDARY)
).QueueFuseable.NONE
, QueueFuseable.SYNC
, QueueFuseable.ASYNC
.public final void complete(T value)
value
- the value to signal, not null (not verified)public final void error(Throwable t)
t
- the Throwable to signal, not null (not verified)public final void complete()
@Nullable public final T poll() throws Exception
SimpleQueue
If the producer uses SimpleQueue.offer(Object, Object)
and
when polling in pairs, if the first poll() returns a non-null
item, the second poll() is guaranteed to return a non-null item
as well.
Exception
- if some pre-processing of the dequeued
item (usually through fused functions) throws.public final boolean isEmpty()
SimpleQueue
Note however that due to potential fused functions in SimpleQueue.poll()
it is possible this method returns false but then poll() returns null
because the fused function swallowed the available item(s).
public final void clear()
SimpleQueue
public void dispose()
Disposable
public final boolean tryDispose()
public final boolean isDisposed()
Disposable
Copyright © 2018 JBoss by Red Hat. All rights reserved.