Top Description Fields Constructors Methods
io.reactivex.rxjava3.internal.observers

public Class DeferredScalarDisposable<T>

extends BasicIntQueueDisposable<T>
Class Inheritance
Known Direct Subclasses
io.reactivex.rxjava3.internal.observers.DeferredScalarObserver, io.reactivex.rxjava3.internal.operators.maybe.MaybeToObservable.MaybeToObservableObserver, io.reactivex.rxjava3.internal.operators.single.SingleToObservable.SingleToObservableObserver, io.reactivex.rxjava3.subjects.AsyncSubject.AsyncDisposable, io.reactivex.rxjava3.internal.jdk8.ObservableCollectWithCollector.CollectorObserver, io.reactivex.rxjava3.internal.jdk8.ObservableFromCompletionStage.CompletionStageHandler
Type Parameters
<T>
the value type received and emitted
Imports
io.reactivex.rxjava3.annotations.Nullable, io.reactivex.rxjava3.core.Observer, io.reactivex.rxjava3.plugins.RxJavaPlugins

Represents a fuseable container for a single value.

Field Summary

Modifier and TypeField and Description
pack-priv static final int
DISPOSED

Indicates the Disposable has been disposed.

protected final Observer<? super T>
downstream

The target of the events.

pack-priv static final int
FUSED_CONSUMED

Indicates this Disposable is in fusion mode and its value has been consumed.

pack-priv static final int
FUSED_EMPTY

Indicates this Disposable is in fusion mode and is currently empty.

pack-priv static final int
FUSED_READY

Indicates this Disposable is in fusion mode and has a value.

private static final long
pack-priv static final int
TERMINATED

Indicates there was a call to complete(T).

protected T
value

Hides java.util.concurrent.atomic.AtomicInteger.value.

The value stored temporarily when in fusion mode.

Constructor Summary

AccessConstructor and Description
public
DeferredScalarDisposable(Observer<? super T>
the Observer to wrap, not null (not verified)
downstream
)

Constructs a DeferredScalarDisposable by wrapping the Observer.

Method Summary

Modifier and TypeMethod and Description
public final void
clear()

Implements io.reactivex.rxjava3.operators.SimpleQueue.clear.

Removes all enqueued items from this queue.
public final void
complete(T
the value to signal, not null (not verified)
value
)

Complete the target with a single value or indicate there is a value available in fusion mode.

public final void
complete()

Complete the target without any value.

public void
dispose()

Implements io.reactivex.rxjava3.disposables.Disposable.dispose.

Dispose the resource, the operation should be idempotent.
public final void
error(Throwable
the Throwable to signal, not null (not verified)
t
)

Complete the target with an error signal.

public final boolean
isDisposed()

Implements io.reactivex.rxjava3.disposables.Disposable.isDisposed.

Returns true if this resource has been disposed.
public final boolean
isEmpty()

Implements io.reactivex.rxjava3.operators.SimpleQueue.isEmpty.

Returns true if the queue is empty.
public final T
poll()

Implements io.reactivex.rxjava3.operators.SimpleQueue.poll.

Tries to dequeue a value (non-null) or returns null if the queue is empty.
public final int
requestFusion(int
the requested fusion mode, allowed values are SYNC, ASYNC, ANY combined with BOUNDARY (e.g., requestFusion(SYNC | BOUNDARY)).
mode
)

Implements io.reactivex.rxjava3.operators.QueueFuseable.requestFusion.

Request a fusion mode from the upstream.
public final boolean

Returns:

true if the current thread succeeded
tryDispose
()

Try disposing this Disposable and return true if the current thread succeeded.

Inherited from io.reactivex.rxjava3.internal.observers.BasicIntQueueDisposable:
offeroffer

Field Detail

DISPOSEDback to summary
pack-priv static final int DISPOSED

Indicates the Disposable has been disposed.

downstreamback to summary
protected final Observer<? super T> downstream

The target of the events.

FUSED_CONSUMEDback to summary
pack-priv static final int FUSED_CONSUMED

Indicates this Disposable is in fusion mode and its value has been consumed.

FUSED_EMPTYback to summary
pack-priv static final int FUSED_EMPTY

Indicates this Disposable is in fusion mode and is currently empty.

FUSED_READYback to summary
pack-priv static final int FUSED_READY

Indicates this Disposable is in fusion mode and has a value.

serialVersionUIDback to summary
private static final long serialVersionUID

Hides io.reactivex.rxjava3.internal.observers.BasicIntQueueDisposable.serialVersionUID.

TERMINATEDback to summary
pack-priv static final int TERMINATED

Indicates there was a call to complete(T).

valueback to summary
protected T value

Hides java.util.concurrent.atomic.AtomicInteger.value.

The value stored temporarily when in fusion mode.

Constructor Detail

DeferredScalarDisposableback to summary
public DeferredScalarDisposable(Observer<? super T> downstream)

Constructs a DeferredScalarDisposable by wrapping the Observer.

Parameters
downstream:Observer<? super T>

the Observer to wrap, not null (not verified)

Method Detail

clearback to summary
public final void clear()

Implements io.reactivex.rxjava3.operators.SimpleQueue.clear.

Doc from io.reactivex.rxjava3.operators.SimpleQueue.clear.

Removes all enqueued items from this queue.

Annotations
@Override
completeback to summary
public final void complete(T value)

Complete the target with a single value or indicate there is a value available in fusion mode.

Parameters
value:T

the value to signal, not null (not verified)

completeback to summary
public final void complete()

Complete the target without any value.

disposeback to summary
public void dispose()

Implements io.reactivex.rxjava3.disposables.Disposable.dispose.

Doc from io.reactivex.rxjava3.disposables.Disposable.dispose.

Dispose the resource, the operation should be idempotent.

Annotations
@Override
errorback to summary
public final void error(Throwable t)

Complete the target with an error signal.

Parameters
t:Throwable

the Throwable to signal, not null (not verified)

isDisposedback to summary
public final boolean isDisposed()

Implements io.reactivex.rxjava3.disposables.Disposable.isDisposed.

Doc from io.reactivex.rxjava3.disposables.Disposable.isDisposed.

Returns true if this resource has been disposed.

Returns:boolean

true if this resource has been disposed

Annotations
@Override
isEmptyback to summary
public final boolean isEmpty()

Implements io.reactivex.rxjava3.operators.SimpleQueue.isEmpty.

Doc from io.reactivex.rxjava3.operators.SimpleQueue.isEmpty.

Returns true if the queue is empty.

Note however that due to potential fused functions in poll() it is possible this method returns false but then poll() returns null because the fused function swallowed the available item(s).

Returns:boolean

true if the queue is empty

Annotations
@Override
pollback to summary
public final T poll()

Implements io.reactivex.rxjava3.operators.SimpleQueue.poll.

Doc from io.reactivex.rxjava3.operators.SimpleQueue.poll.

Tries to dequeue a value (non-null) or returns null if the queue is empty.

If the producer uses 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.

Returns:T

the item or null to indicate an empty queue

Annotations
@Nullable
@Override
requestFusionback to summary
public final int requestFusion(int mode)

Implements io.reactivex.rxjava3.operators.QueueFuseable.requestFusion.

Doc from io.reactivex.rxjava3.operators.QueueFuseable.requestFusion.

Request a fusion mode from the upstream.

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.

Parameters
mode:int

the requested fusion mode, allowed values are SYNC, ASYNC, ANY combined with BOUNDARY (e.g., requestFusion(SYNC | BOUNDARY)).

Returns:int

the established fusion mode: NONE, SYNC, ASYNC.

Annotations
@Override
tryDisposeback to summary
public final boolean tryDispose()

Try disposing this Disposable and return true if the current thread succeeded.

Returns:boolean

true if the current thread succeeded