E - type of the elements stored in the Queue.public class OneToOneConcurrentArrayQueue<E> extends AbstractConcurrentArrayQueue<E>
Unsafe.| Modifier and Type | Field and Description |
|---|---|
protected long |
head
Head index.
|
protected long |
headCache
Cached head index.
|
protected long |
sharedHeadCache
Shared cached head index.
|
protected long |
tail
Tail index.
|
buffer, BUFFER_ARRAY_BASE, capacity, HEAD_OFFSET, SHARED_HEAD_CACHE_OFFSET, SHIFT_FOR_SCALE, TAIL_OFFSET| Constructor and Description |
|---|
OneToOneConcurrentArrayQueue(int requestedCapacity)
Constructs queue with the requested capacity.
|
| Modifier and Type | Method and Description |
|---|---|
int |
drain(Consumer<E> elementConsumer)
Drain the number of elements present in a collection at the time the operation starts.
|
int |
drain(Consumer<E> elementConsumer,
int limit)
Drain the minimum of a limit and the number of elements present in a collection at the time the operation starts.
|
int |
drainTo(Collection<? super E> target,
int limit)
Drain available elements into the provided
Collection up to a provided maximum limit of
elements. |
boolean |
offer(E e) |
E |
poll() |
add, addAll, addedCount, capacity, clear, contains, containsAll, element, isEmpty, iterator, peek, remainingCapacity, remove, remove, removeAll, removedCount, retainAll, sequenceToBufferOffset, size, toArray, toArrayclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitequals, hashCode, parallelStream, removeIf, spliterator, streamprotected volatile long head
protected volatile long tail
protected long headCache
protected volatile long sharedHeadCache
public OneToOneConcurrentArrayQueue(int requestedCapacity)
requestedCapacity - of the queue.public boolean offer(E e)
public E poll()
public int drain(Consumer<E> elementConsumer)
If possible, implementations should use smart batching to best handle burst traffic.
elementConsumer - Consumer for processing elements.public int drain(Consumer<E> elementConsumer, int limit)
If possible, implementations should use smart batching to best handle burst traffic.
elementConsumer - Consumer for processing elements.limit - maximum number of elements to be drained in a drain operation.public int drainTo(Collection<? super E> target, int limit)
Collection up to a provided maximum limit of
elements.
If possible, implementations should use smart batching to best handle burst traffic.
target - in to which elements are drained.limit - maximum number of elements to be drained in a drain operation.Copyright © 2014-2022 Real Logic Limited. All Rights Reserved.