Top Description Fields Constructors Methods
io.reactivex.internal.subscriptions

public final Enum EmptySubscription

extends Enum<EmptySubscription>
implements QueueSubscription<Object>
Class Inheritance
All Implemented Interfaces
io.reactivex.internal.fuseable.QueueSubscription, org.reactivestreams.Subscription, io.reactivex.internal.fuseable.QueueFuseable, io.reactivex.internal.fuseable.SimpleQueue
Imports
io.reactivex.annotations.Nullable, org.reactivestreams.Subscriber, io.reactivex.internal.fuseable.QueueSubscription

An empty subscription that does nothing other than validates the request amount.

Field Summary

Modifier and TypeField and Description
public static final EmptySubscription
INSTANCE

A singleton, stateless instance.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public void
cancel()

Implements org.reactivestreams.Subscription.cancel.

Request the Publisher to stop sending data and clean up resources.
public void
clear()

Implements io.reactivex.internal.fuseable.SimpleQueue.clear.

Removes all enqueued items from this queue.
public static void
complete(Subscriber<?>
the target subscriber
s
)

Sets the empty subscription instance on the subscriber and then calls onComplete.

public static void
error(Throwable
the error to deliver to the subscriber
e
,
Subscriber<?>
the target subscriber
s
)

Sets the empty subscription instance on the subscriber and then calls onError with the supplied error.

public boolean
isEmpty()

Implements io.reactivex.internal.fuseable.SimpleQueue.isEmpty.

Returns true if the queue is empty.
public boolean
offer(Object
the value to enqueue, not null
value
)

Implements io.reactivex.internal.fuseable.SimpleQueue.offer.

Atomically enqueue a single.
public boolean
offer(Object
the first value to enqueue, not null
v1
,
Object
the second value to enqueue, not null
v2
)

Implements io.reactivex.internal.fuseable.SimpleQueue.offer.

Atomically enqueue two values.
public Object
poll()

Implements io.reactivex.internal.fuseable.SimpleQueue.poll.

Tries to dequeue a value (non-null) or returns null if the queue is empty.
public void
request(long
the strictly positive number of elements to requests to the upstream Publisher
n
)

Implements org.reactivestreams.Subscription.request.

No events will be sent by a Publisher until demand is signaled via this method.
public 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.internal.fuseable.QueueFuseable.requestFusion.

Request a fusion mode from the upstream.
public String
toString()

Overrides java.lang.Enum.toString.

Returns the name of this enum constant, as contained in the declaration.
public static EmptySubscription
public static EmptySubscription[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinalvalueOf

Field Detail

INSTANCEback to summary
public static final EmptySubscription INSTANCE

A singleton, stateless instance.

Constructor Detail

EmptySubscriptionback to summary
private EmptySubscription()

Method Detail

cancelback to summary
public void cancel()

Implements org.reactivestreams.Subscription.cancel.

Doc from org.reactivestreams.Subscription.cancel.

Request the Publisher to stop sending data and clean up resources.

Data may still be sent to meet previously signalled demand after calling cancel.

Annotations
@Override
clearback to summary
public void clear()

Implements io.reactivex.internal.fuseable.SimpleQueue.clear.

Doc from io.reactivex.internal.fuseable.SimpleQueue.clear.

Removes all enqueued items from this queue.

Annotations
@Override
completeback to summary
public static void complete(Subscriber<?> s)

Sets the empty subscription instance on the subscriber and then calls onComplete.

Make sure this is only called if the subscriber hasn't received a subscription already (there is no way of telling this).

Parameters
s:Subscriber<?>

the target subscriber

errorback to summary
public static void error(Throwable e, Subscriber<?> s)

Sets the empty subscription instance on the subscriber and then calls onError with the supplied error.

Make sure this is only called if the subscriber hasn't received a subscription already (there is no way of telling this).

Parameters
e:Throwable

the error to deliver to the subscriber

s:Subscriber<?>

the target subscriber

isEmptyback to summary
public boolean isEmpty()

Implements io.reactivex.internal.fuseable.SimpleQueue.isEmpty.

Doc from io.reactivex.internal.fuseable.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
offerback to summary
public boolean offer(Object value)

Implements io.reactivex.internal.fuseable.SimpleQueue.offer.

Doc from io.reactivex.internal.fuseable.SimpleQueue.offer.

Atomically enqueue a single.

Parameters
value:Object

the value to enqueue, not null

Returns:boolean

true if successful, false if the value was not enqueued likely due to reaching the queue capacity)

Annotations
@Override
offerback to summary
public boolean offer(Object v1, Object v2)

Implements io.reactivex.internal.fuseable.SimpleQueue.offer.

Doc from io.reactivex.internal.fuseable.SimpleQueue.offer.

Atomically enqueue two values.

Parameters
v1:Object

the first value to enqueue, not null

v2:Object

the second value to enqueue, not null

Returns:boolean

true if successful, false if the value was not enqueued likely due to reaching the queue capacity)

Annotations
@Override
pollback to summary
public Object poll()

Implements io.reactivex.internal.fuseable.SimpleQueue.poll.

Doc from io.reactivex.internal.fuseable.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:Object

the item or null to indicate an empty queue

Annotations
@Nullable
@Override
requestback to summary
public void request(long n)

Implements org.reactivestreams.Subscription.request.

Doc from org.reactivestreams.Subscription.request.

No events will be sent by a Publisher until demand is signaled via this method.

It can be called however often and whenever needed—but if the outstanding cumulative demand ever becomes Long.MAX_VALUE or more, it may be treated by the Publisher as "effectively unbounded".

Whatever has been requested can be sent by the Publisher so only signal demand for what can be safely handled.

A Publisher can send less than is requested if the stream ends but then must emit either Subscriber#onError(Throwable) or Subscriber#onComplete().

Parameters
n:long

the strictly positive number of elements to requests to the upstream Publisher

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

Implements io.reactivex.internal.fuseable.QueueFuseable.requestFusion.

Doc from io.reactivex.internal.fuseable.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
toStringback to summary
public String toString()

Overrides java.lang.Enum.toString.

Doc from java.lang.Enum.toString.

Returns the name of this enum constant, as contained in the declaration. This method may be overridden, though it typically isn't necessary or desirable. An enum class should override this method when a more "programmer-friendly" string form exists.

Returns:String

the name of this enum constant

Annotations
@Override
valueOfback to summary
public static EmptySubscription valueOf(String name)
valuesback to summary
public static EmptySubscription[] values()