T - the contained value typepublic final class SpscLinkedArrayQueue<T>
extends java.lang.Object
implements java.util.Queue<T>
| Modifier and Type | Field and Description |
|---|---|
protected java.util.concurrent.atomic.AtomicReferenceArray<java.lang.Object> |
consumerBuffer |
protected long |
consumerIndex |
protected int |
consumerMask |
protected java.util.concurrent.atomic.AtomicReferenceArray<java.lang.Object> |
producerBuffer |
protected long |
producerIndex |
protected long |
producerLookAhead |
protected int |
producerLookAheadStep |
protected int |
producerMask |
| Constructor and Description |
|---|
SpscLinkedArrayQueue(int bufferSize) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(T e) |
boolean |
addAll(java.util.Collection<? extends T> c) |
void |
clear() |
boolean |
contains(java.lang.Object o) |
boolean |
containsAll(java.util.Collection<?> c) |
T |
element() |
boolean |
isEmpty() |
java.util.Iterator<T> |
iterator() |
boolean |
offer(T e)
This implementation is correct for single producer thread use only.
|
boolean |
offer(T first,
T second)
Offer two elements at the same time.
|
T |
peek()
This implementation is correct for single consumer thread use only.
|
T |
poll()
This implementation is correct for single consumer thread use only.
|
T |
remove() |
boolean |
remove(java.lang.Object o) |
boolean |
removeAll(java.util.Collection<?> c) |
boolean |
retainAll(java.util.Collection<?> c) |
int |
size() |
java.lang.Object[] |
toArray() |
<E> E[] |
toArray(E[] a) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitprotected volatile long producerIndex
protected int producerLookAheadStep
protected long producerLookAhead
protected int producerMask
protected java.util.concurrent.atomic.AtomicReferenceArray<java.lang.Object> producerBuffer
protected int consumerMask
protected java.util.concurrent.atomic.AtomicReferenceArray<java.lang.Object> consumerBuffer
protected volatile long consumerIndex
public final boolean offer(T e)
This implementation is correct for single producer thread use only.
offer in interface java.util.Queue<T>public final T poll()
This implementation is correct for single consumer thread use only.
poll in interface java.util.Queue<T>public final T peek()
This implementation is correct for single consumer thread use only.
peek in interface java.util.Queue<T>public void clear()
clear in interface java.util.Collection<T>public final int size()
size in interface java.util.Collection<T>public boolean isEmpty()
isEmpty in interface java.util.Collection<T>public final java.util.Iterator<T> iterator()
public boolean contains(java.lang.Object o)
contains in interface java.util.Collection<T>public java.lang.Object[] toArray()
toArray in interface java.util.Collection<T>public <E> E[] toArray(E[] a)
toArray in interface java.util.Collection<T>public boolean remove(java.lang.Object o)
remove in interface java.util.Collection<T>public boolean containsAll(java.util.Collection<?> c)
containsAll in interface java.util.Collection<T>public boolean addAll(java.util.Collection<? extends T> c)
addAll in interface java.util.Collection<T>public boolean removeAll(java.util.Collection<?> c)
removeAll in interface java.util.Collection<T>public boolean retainAll(java.util.Collection<?> c)
retainAll in interface java.util.Collection<T>public boolean add(T e)