E
- the element type@SuppressAnimalSniffer public abstract class ConcurrentCircularArrayQueue<E> extends AbstractQueue<E>
Offset calculation is separate from access to enable the reuse of a give compute offset.
Load/Store methods using a buffer parameter are provided to allow the prevention of final field reload after a LoadLoad barrier.
Modifier and Type | Field and Description |
---|---|
protected E[] |
buffer |
protected static int |
BUFFER_PAD |
protected long |
mask |
protected static int |
SPARSE_SHIFT |
Constructor and Description |
---|
ConcurrentCircularArrayQueue(int capacity) |
Modifier and Type | Method and Description |
---|---|
protected long |
calcElementOffset(long index) |
protected long |
calcElementOffset(long index,
long mask) |
void |
clear() |
Iterator<E> |
iterator() |
protected E |
lpElement(E[] buffer,
long offset)
A plain load (no ordering/fences) of an element from a given offset.
|
protected E |
lpElement(long offset)
A plain load (no ordering/fences) of an element from a given offset.
|
protected E |
lvElement(E[] buffer,
long offset)
A volatile load (load + LoadLoad barrier) of an element from a given offset.
|
protected E |
lvElement(long offset)
A volatile load (load + LoadLoad barrier) of an element from a given offset.
|
protected void |
soElement(E[] buffer,
long offset,
E e)
An ordered store(store + StoreStore barrier) of an element to a given offset
|
protected void |
soElement(long offset,
E e)
An ordered store(store + StoreStore barrier) of an element to a given offset
|
protected void |
spElement(E[] buffer,
long offset,
E e)
A plain store (no ordering/fences) of an element to a given offset
|
protected void |
spElement(long offset,
E e)
A plain store (no ordering/fences) of an element to a given offset
|
add, addAll, element, remove
contains, containsAll, isEmpty, remove, removeAll, retainAll, size, toArray, toArray, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
isEmpty, offer, peek, poll, size
contains, containsAll, equals, hashCode, isEmpty, parallelStream, remove, removeAll, removeIf, retainAll, size, spliterator, stream, toArray, toArray
protected static final int SPARSE_SHIFT
protected static final int BUFFER_PAD
protected final long mask
protected final E[] buffer
protected final long calcElementOffset(long index)
index
- desirable element indexprotected final long calcElementOffset(long index, long mask)
index
- desirable element indexmask
- the binary mask to make the index wrap aroundprotected final void spElement(long offset, E e)
offset
- computed via calcElementOffset(long)
e
- a kittyprotected final void spElement(E[] buffer, long offset, E e)
buffer
- this.bufferoffset
- computed via calcElementOffset(long)
e
- an orderly kittyprotected final void soElement(long offset, E e)
offset
- computed via calcElementOffset(long)
e
- an orderly kittyprotected final void soElement(E[] buffer, long offset, E e)
buffer
- this.bufferoffset
- computed via calcElementOffset(long)
e
- an orderly kittyprotected final E lpElement(long offset)
offset
- computed via calcElementOffset(long)
protected final E lpElement(E[] buffer, long offset)
buffer
- this.bufferoffset
- computed via calcElementOffset(long)
protected final E lvElement(long offset)
offset
- computed via calcElementOffset(long)
protected final E lvElement(E[] buffer, long offset)
buffer
- this.bufferoffset
- computed via calcElementOffset(long)
public Iterator<E> iterator()
iterator
in interface Iterable<E>
iterator
in interface Collection<E>
iterator
in class AbstractCollection<E>
public void clear()
clear
in interface Collection<E>
clear
in class AbstractQueue<E>
Copyright © 2017. All rights reserved.