public abstract class AbstractConcurrentArrayQueue<E> extends Object implements QueuedPipe<E>
| Modifier and Type | Field and Description |
|---|---|
protected E[] |
buffer
Backing array.
|
protected static int |
BUFFER_ARRAY_BASE
Array base.
|
protected int |
capacity
Queue capacity.
|
protected long |
head
Head index.
|
protected static long |
HEAD_OFFSET
Offset of the
head field. |
protected long |
headCache
Cached head index.
|
protected static long |
SHARED_HEAD_CACHE_OFFSET
Offset of the
sharedHeadCache field. |
protected long |
sharedHeadCache
Shared cached head index.
|
protected static int |
SHIFT_FOR_SCALE
Shift for scale.
|
protected long |
tail
Tail index.
|
protected static long |
TAIL_OFFSET
Offset of the
tail field. |
| Constructor and Description |
|---|
AbstractConcurrentArrayQueue(int requestedCapacity)
Constructs a queue with the requested capacity.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(E e) |
boolean |
addAll(Collection<? extends E> c) |
long |
addedCount()
The number of items added to this container since creation.
|
int |
capacity()
The maximum capacity of this container to hold items.
|
void |
clear() |
boolean |
contains(Object o) |
boolean |
containsAll(Collection<?> c) |
E |
element() |
boolean |
isEmpty() |
Iterator<E> |
iterator() |
E |
peek() |
int |
remainingCapacity()
Get the remaining capacity for elements in the container given the current size.
|
E |
remove() |
boolean |
remove(Object o) |
boolean |
removeAll(Collection<?> c) |
long |
removedCount()
The number of items removed from this container since creation.
|
boolean |
retainAll(Collection<?> c) |
static long |
sequenceToBufferOffset(long sequence,
long mask)
Compute buffer offset based on the given sequence and the mask.
|
int |
size()
The number of items currently in the container.
|
Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitequals, hashCode, parallelStream, removeIf, spliterator, streamprotected static final long TAIL_OFFSET
tail field.protected static final long SHARED_HEAD_CACHE_OFFSET
sharedHeadCache field.protected static final long HEAD_OFFSET
head field.protected static final int BUFFER_ARRAY_BASE
protected static final int SHIFT_FOR_SCALE
protected final int capacity
protected final E[] buffer
protected volatile long head
protected volatile long tail
protected long headCache
protected volatile long sharedHeadCache
public AbstractConcurrentArrayQueue(int requestedCapacity)
requestedCapacity - of the queue.public long addedCount()
addedCount in interface Pipe<E>public long removedCount()
removedCount in interface Pipe<E>public int capacity()
public int remainingCapacity()
remainingCapacity in interface Pipe<E>public boolean add(E e)
public boolean contains(Object o)
contains in interface Collection<E>public Object[] toArray()
toArray in interface Collection<E>public <T> T[] toArray(T[] a)
toArray in interface Collection<E>public boolean remove(Object o)
remove in interface Collection<E>public boolean containsAll(Collection<?> c)
containsAll in interface Collection<E>public boolean addAll(Collection<? extends E> c)
addAll in interface Collection<E>public boolean removeAll(Collection<?> c)
removeAll in interface Collection<E>public boolean retainAll(Collection<?> c)
retainAll in interface Collection<E>public void clear()
clear in interface Collection<E>public boolean isEmpty()
isEmpty in interface Collection<E>public int size()
public static long sequenceToBufferOffset(long sequence,
long mask)
sequence - to compute the offset from.mask - to apply.Copyright © 2014-2021 Real Logic Limited. All Rights Reserved.