public enum EmptyDisposable extends Enum<EmptyDisposable> implements QueueDisposable<Object>
It is also async-fuseable but empty all the time.
Since EmptyDisposable implements QueueDisposable and is empty, don't use it in tests and then signal onNext with it; use Disposables.empty() instead.
Enum Constant and Description |
---|
INSTANCE
Since EmptyDisposable implements QueueDisposable and is empty,
don't use it in tests and then signal onNext with it;
use Disposables.empty() instead.
|
NEVER
An empty disposable that returns false for isDisposed.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Removes all enqueued items from this queue.
|
static void |
complete(CompletableObserver s) |
static void |
complete(MaybeObserver<?> s) |
static void |
complete(Observer<?> s) |
void |
dispose()
Dispose the resource, the operation should be idempotent.
|
static void |
error(Throwable e,
CompletableObserver s) |
static void |
error(Throwable e,
MaybeObserver<?> s) |
static void |
error(Throwable e,
Observer<?> s) |
static void |
error(Throwable e,
SingleObserver<?> s) |
boolean |
isDisposed()
Returns true if this resource has been disposed.
|
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.
|
int |
requestFusion(int mode)
Request a fusion mode from the upstream.
|
static EmptyDisposable |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static EmptyDisposable[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final EmptyDisposable INSTANCE
public static final EmptyDisposable NEVER
public static EmptyDisposable[] values()
for (EmptyDisposable c : EmptyDisposable.values()) System.out.println(c);
public static EmptyDisposable 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 dispose()
Disposable
dispose
in interface Disposable
public boolean isDisposed()
Disposable
isDisposed
in interface Disposable
public static void complete(Observer<?> s)
public static void complete(MaybeObserver<?> s)
public static void complete(CompletableObserver s)
public static void error(Throwable e, CompletableObserver s)
public static void error(Throwable e, SingleObserver<?> s)
public static void error(Throwable e, MaybeObserver<?> s)
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 null@Nullable public Object 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.
poll
in interface SimpleQueue<Object>
Exception
- if some pre-processing of the dequeued
item (usually through fused functions) throws.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
.Copyright © 2018 JBoss by Red Hat. All rights reserved.