|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.concurrent.atomic.AtomicReference<AbstractNodeQueue.Node<T>> akka.dispatch.AbstractNodeQueue<T>
public abstract class AbstractNodeQueue<T>
Lock-free MPSC linked queue implementation based on Dmitriy Vyukov's non-intrusive MPSC queue: http://www.1024cores.net/home/lock-free-algorithms/queues/non-intrusive-mpsc-node-based-queue This queue could be wait-free (i.e. without the spinning loops in peekNode and pollNode) if it were permitted to return null while the queue is not quite empty anymore but the enqueued element is not yet visible. This would break actor scheduling, though.
Nested Class Summary | |
---|---|
static class |
AbstractNodeQueue.Node<T>
|
Constructor Summary | |
---|---|
protected |
AbstractNodeQueue()
|
Method Summary | |
---|---|
void |
add(T value)
Add an element to the head of the queue. |
void |
addNode(AbstractNodeQueue.Node<T> n)
Add an element to the head of the queue, providing the queue node to be used. |
int |
count()
This method returns an upper bound on the queue size at the time it starts executing. |
boolean |
isEmpty()
Query the queue whether it is empty right now. |
T |
peek()
Query the queue tail for the next element without dequeuing it. |
protected AbstractNodeQueue.Node<T> |
peekNode()
Query the queue tail for the next element without dequeuing it. |
T |
poll()
Pull one item from the queue’s tail if there is one. |
AbstractNodeQueue.Node<T> |
pollNode()
Pull one item from the queue, returning it within a queue node. |
Methods inherited from class java.util.concurrent.atomic.AtomicReference |
---|
compareAndSet, get, getAndSet, lazySet, set, toString, weakCompareAndSet |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
protected AbstractNodeQueue()
Method Detail |
---|
protected final AbstractNodeQueue.Node<T> peekNode()
public final T peek()
public final void add(T value)
value
- the element to be added; must not be nullpublic final void addNode(AbstractNodeQueue.Node<T> n)
n
- the node containing the element to be added; both must not be nullpublic final boolean isEmpty()
public final int count()
public final T poll()
public final AbstractNodeQueue.Node<T> pollNode()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |