T - public class ConcurrentArrayQueue<T> extends AbstractQueue<T>
Queue that uses singly-linked array blocks
to store elements.
This class is a drop-in replacement for ConcurrentLinkedQueue, with similar performance
but producing less garbage because arrays are used to store elements rather than nodes.
The algorithm used is a variation of the algorithm from Gidenstam, Sundell and Tsigas
(http://www.adm.hb.se/~AGD/Presentations/CacheAwareQueue_OPODIS.pdf).| Modifier and Type | Class and Description |
|---|---|
protected static class |
ConcurrentArrayQueue.Block<E> |
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_BLOCK_SIZE |
static Object |
REMOVED_ELEMENT |
| Constructor and Description |
|---|
ConcurrentArrayQueue() |
ConcurrentArrayQueue(int blockSize) |
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
casHeadBlock(ConcurrentArrayQueue.Block<T> current,
ConcurrentArrayQueue.Block<T> update) |
protected boolean |
casTailBlock(ConcurrentArrayQueue.Block<T> current,
ConcurrentArrayQueue.Block<T> update) |
protected int |
getBlockCount() |
int |
getBlockSize() |
protected ConcurrentArrayQueue.Block<T> |
getHeadBlock() |
protected ConcurrentArrayQueue.Block<T> |
getTailBlock() |
Iterator<T> |
iterator() |
protected ConcurrentArrayQueue.Block<T> |
newBlock() |
boolean |
offer(T item) |
T |
peek() |
T |
poll() |
boolean |
remove(Object o) |
boolean |
removeAll(Collection<?> c) |
boolean |
retainAll(Collection<?> c) |
int |
size() |
contains, containsAll, isEmpty, toArray, toArray, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcontains, containsAll, equals, hashCode, isEmpty, toArray, toArraypublic static final int DEFAULT_BLOCK_SIZE
public static final Object REMOVED_ELEMENT
public ConcurrentArrayQueue()
public ConcurrentArrayQueue(int blockSize)
public int getBlockSize()
protected ConcurrentArrayQueue.Block<T> getHeadBlock()
protected ConcurrentArrayQueue.Block<T> getTailBlock()
public boolean offer(T item)
protected boolean casTailBlock(ConcurrentArrayQueue.Block<T> current, ConcurrentArrayQueue.Block<T> update)
public T poll()
protected boolean casHeadBlock(ConcurrentArrayQueue.Block<T> current, ConcurrentArrayQueue.Block<T> update)
public T peek()
public boolean remove(Object o)
remove in interface Collection<T>remove in class AbstractCollection<T>public boolean removeAll(Collection<?> c)
removeAll in interface Collection<T>removeAll in class AbstractCollection<T>public boolean retainAll(Collection<?> c)
retainAll in interface Collection<T>retainAll in class AbstractCollection<T>public Iterator<T> iterator()
iterator in interface Iterable<T>iterator in interface Collection<T>iterator in class AbstractCollection<T>public int size()
size in interface Collection<T>size in class AbstractCollection<T>protected ConcurrentArrayQueue.Block<T> newBlock()
protected int getBlockCount()
Copyright © 1995-2015 Webtide. All Rights Reserved.