T
- the value type to offer and poll, not nullpublic interface SimpleQueue<T>
Modifier and Type | Method and Description |
---|---|
void |
clear()
Removes all enqueued items from this queue.
|
boolean |
isEmpty()
Returns true if the queue is empty.
|
boolean |
offer(T value)
Atomically enqueue a single.
|
boolean |
offer(T v1,
T v2)
Atomically enqueue two values.
|
T |
poll()
Tries to dequeue a value (non-null) or returns null if
the queue is empty.
|
boolean offer(@NonNull T value)
value
- the value to enqueue, not nullboolean offer(@NonNull T v1, @NonNull T v2)
v1
- the first value to enqueue, not nullv2
- the second value to enqueue, not null@Nullable T poll() throws Exception
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.
Exception
- if some pre-processing of the dequeued
item (usually through fused functions) throws.boolean isEmpty()
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).
void clear()
Copyright © 2018 JBoss by Red Hat. All rights reserved.