public enum EmptySubscription extends Enum<EmptySubscription> implements QueueSubscription<Object>
Enum Constant and Description |
---|
INSTANCE
A singleton, stateless instance.
|
Modifier and Type | Method and Description |
---|---|
void |
cancel() |
void |
clear()
Removes all enqueued items from this queue.
|
static void |
complete(org.reactivestreams.Subscriber<?> s)
Sets the empty subscription instance on the subscriber and then
calls onComplete.
|
static void |
error(Throwable e,
org.reactivestreams.Subscriber<?> s)
Sets the empty subscription instance on the subscriber and then
calls onError with the supplied error.
|
boolean |
isEmpty()
Returns true if the queue is empty.
|
boolean |
offer(Object value)
Atomically enqueue a single.
|
boolean |
offer(Object v1,
Object v2)
Atomically enqueue two values.
|
Object |
poll()
Tries to dequeue a value (non-null) or returns null if
the queue is empty.
|
void |
request(long n) |
int |
requestFusion(int mode)
Request a fusion mode from the upstream.
|
String |
toString() |
static EmptySubscription |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static EmptySubscription[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final EmptySubscription INSTANCE
public static EmptySubscription[] values()
for (EmptySubscription c : EmptySubscription.values()) System.out.println(c);
public static EmptySubscription valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic void request(long n)
request
in interface org.reactivestreams.Subscription
public void cancel()
cancel
in interface org.reactivestreams.Subscription
public String toString()
toString
in class Enum<EmptySubscription>
public static void error(Throwable e, org.reactivestreams.Subscriber<?> s)
Make sure this is only called if the subscriber hasn't received a subscription already (there is no way of telling this).
e
- the error to deliver to the subscribers
- the target subscriberpublic static void complete(org.reactivestreams.Subscriber<?> s)
Make sure this is only called if the subscriber hasn't received a subscription already (there is no way of telling this).
s
- the target subscriber@Nullable public Object poll()
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.
poll
in interface SimpleQueue<Object>
public 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).
isEmpty
in interface SimpleQueue<Object>
public void clear()
SimpleQueue
clear
in interface SimpleQueue<Object>
public 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.
requestFusion
in interface QueueFuseable<Object>
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 boolean offer(Object value)
SimpleQueue
offer
in interface SimpleQueue<Object>
value
- the value to enqueue, not nullpublic boolean offer(Object v1, Object v2)
SimpleQueue
offer
in interface SimpleQueue<Object>
v1
- the first value to enqueue, not nullv2
- the second value to enqueue, not nullCopyright © 2018 JBoss by Red Hat. All rights reserved.