T - the Array entry typepublic class ConcurrentArrayQueue<T>
extends java.util.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 | Description |
|---|---|---|
protected static class |
ConcurrentArrayQueue.Block<E> |
| Modifier and Type | Field | Description |
|---|---|---|
static int |
DEFAULT_BLOCK_SIZE |
|
static java.lang.Object |
REMOVED_ELEMENT |
| Constructor | Description |
|---|---|
ConcurrentArrayQueue() |
|
ConcurrentArrayQueue(int blockSize) |
| Modifier and Type | Method | 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() |
|
java.util.Iterator<T> |
iterator() |
|
protected ConcurrentArrayQueue.Block<T> |
newBlock() |
|
boolean |
offer(T item) |
|
T |
peek() |
|
T |
poll() |
|
boolean |
remove(java.lang.Object o) |
|
boolean |
removeAll(java.util.Collection<?> c) |
|
boolean |
retainAll(java.util.Collection<?> c) |
|
int |
size() |
contains, containsAll, isEmpty, toArray, toArray, toStringpublic static final int DEFAULT_BLOCK_SIZE
public static final java.lang.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(java.lang.Object o)
remove in class java.util.AbstractCollection<T>public boolean removeAll(java.util.Collection<?> c)
removeAll in class java.util.AbstractCollection<T>public boolean retainAll(java.util.Collection<?> c)
retainAll in class java.util.AbstractCollection<T>public java.util.Iterator<T> iterator()
iterator in class java.util.AbstractCollection<T>public int size()
size in class java.util.AbstractCollection<T>protected ConcurrentArrayQueue.Block<T> newBlock()
protected int getBlockCount()
Copyright © 1995–2018 Webtide. All rights reserved.