-
- All Implemented Interfaces:
-
java.io.Serializable
,java.lang.Iterable
,java.util.Collection
,java.util.Queue
public final class SpscExactAtomicArrayQueue<T> extends AtomicReferenceArray<T> implements Queue<T>
A single-producer single-consumer bounded queue with exact capacity tracking.
This means that a queue of 10 will allow exactly 10 offers, however, the underlying storage is still power-of-2.
The implementation uses field updaters and thus should be platform-safe.
-
-
Constructor Summary
Constructors Constructor Description SpscExactAtomicArrayQueue(int capacity)
-
Method Summary
Modifier and Type Method Description boolean
offer(T value)
T
poll()
T
peek()
void
clear()
boolean
isEmpty()
int
size()
boolean
contains(Object o)
Iterator<T>
iterator()
Array<Object>
toArray()
<E> Array<E>
toArray(Array<E> a)
boolean
remove(Object o)
boolean
containsAll(Collection<out Object> c)
boolean
addAll(Collection<out T> c)
boolean
removeAll(Collection<out Object> c)
boolean
retainAll(Collection<out Object> c)
boolean
add(T e)
T
remove()
T
element()
-
Methods inherited from class java.util.concurrent.atomic.AtomicReferenceArray
accumulateAndGet, compareAndSet, get, getAndAccumulate, getAndSet, getAndUpdate, lazySet, length, set, toString, updateAndGet, weakCompareAndSet
-
Methods inherited from class java.util.Queue
add, element, offer, peek, poll, remove
-
Methods inherited from class java.util.Collection
addAll, clear, contains, containsAll, isEmpty, iterator, parallelStream, remove, removeAll, removeIf, retainAll, size, spliterator, stream, toArray, toArray
-
Methods inherited from class java.lang.Iterable
forEach, iterator, spliterator
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
clear
void clear()
-
isEmpty
boolean isEmpty()
-
size
int size()
-
containsAll
boolean containsAll(Collection<out Object> c)
-
addAll
boolean addAll(Collection<out T> c)
-
removeAll
boolean removeAll(Collection<out Object> c)
-
retainAll
boolean retainAll(Collection<out Object> c)
-
-
-
-