E
- 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 long |
mask |
protected static int |
REF_BUFFER_PAD |
protected static int |
SPARSE_SHIFT |
Constructor and Description |
---|
ConcurrentCircularArrayQueue(int capacity) |
Modifier and Type | Method and Description |
---|---|
protected long |
calcElementOffset(long index) |
protected static long |
calcElementOffset(long index,
long mask) |
void |
clear() |
boolean |
isEmpty()
This method's accuracy is subject to concurrent modifications happening as the observation is carried out.
|
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.
|
boolean |
offer(M message)
Called from a producer thread subject to the restrictions appropriate to the implementation and according to the
Queue.offer(Object) interface. |
M |
peek()
Called from the consumer thread subject to the restrictions appropriate to the implementation and according to
the
Queue.peek() interface. |
M |
poll()
Called from the consumer thread subject to the restrictions appropriate to the implementation and according to
the
Queue.poll() interface. |
int |
size()
This method's accuracy is subject to concurrent modifications happening as the size is estimated and as such is a
best effort rather than absolute value.
|
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
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 REF_BUFFER_PAD
protected final long mask
protected final E[] buffer
protected final long calcElementOffset(long index)
index
- desirable element indexprotected static final long calcElementOffset(long index, long mask)
index
- desirable element indexmask
- protected 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>
public boolean offer(M message)
Queue.offer(Object)
interface.message
- public M poll()
Queue.poll()
interface.public M peek()
Queue.peek()
interface.public int size()
Integer.MAX_VALUE
if not boundedpublic boolean isEmpty()
Copyright © 2013-2017. All Rights Reserved.