-
- 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 booleanoffer(T value)Tpoll()Tpeek()voidclear()booleanisEmpty()intsize()booleancontains(Object o)Iterator<T>iterator()Array<Object>toArray()<E> Array<E>toArray(Array<E> a)booleanremove(Object o)booleancontainsAll(Collection<out Object> c)booleanaddAll(Collection<out T> c)booleanremoveAll(Collection<out Object> c)booleanretainAll(Collection<out Object> c)booleanadd(T e)Tremove()Telement()-
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)
-
-
-
-