E
- public class MpscLinkedQueue7<E> extends AbstractQueue<E>
MpscLinkedQueue
Modifier and Type | Field and Description |
---|---|
protected static long |
C_NODE_OFFSET |
protected org.jctools.queues.LinkedQueueNode<E> |
consumerNode |
protected static long |
P_NODE_OFFSET |
protected org.jctools.queues.LinkedQueueNode<E> |
producerNode |
Constructor and Description |
---|
MpscLinkedQueue7() |
Modifier and Type | Method and Description |
---|---|
boolean |
isEmpty()
|
Iterator<E> |
iterator() |
protected org.jctools.queues.LinkedQueueNode<E> |
lpConsumerNode() |
protected org.jctools.queues.LinkedQueueNode<E> |
lpProducerNode() |
protected org.jctools.queues.LinkedQueueNode<E> |
lvConsumerNode() |
protected org.jctools.queues.LinkedQueueNode<E> |
lvProducerNode() |
boolean |
offer(E nextValue)
|
E |
peek() |
E |
poll()
|
int |
size()
|
protected void |
spConsumerNode(org.jctools.queues.LinkedQueueNode<E> node) |
protected void |
spProducerNode(org.jctools.queues.LinkedQueueNode<E> node) |
protected org.jctools.queues.LinkedQueueNode<E> |
xchgProducerNode(org.jctools.queues.LinkedQueueNode<E> newVal) |
contains, containsAll, remove, removeAll, retainAll, toArray, toArray, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
contains, containsAll, equals, hashCode, parallelStream, remove, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArray
protected static final long C_NODE_OFFSET
protected org.jctools.queues.LinkedQueueNode<E> consumerNode
protected static final long P_NODE_OFFSET
protected org.jctools.queues.LinkedQueueNode<E> producerNode
protected final org.jctools.queues.LinkedQueueNode<E> xchgProducerNode(org.jctools.queues.LinkedQueueNode<E> newVal)
public final boolean offer(E nextValue)
IMPLEMENTATION NOTES:
Offer is allowed from multiple threads.
Offer allocates a new node and:
MessagePassingQueue.offer(Object)
,
Queue.offer(java.lang.Object)
public final E poll()
IMPLEMENTATION NOTES:
Poll is allowed from a SINGLE thread.
Poll reads the next node from the consumerNode and:
MessagePassingQueue.poll()
,
Queue.poll()
public final E peek()
public final Iterator<E> iterator()
iterator
in interface Iterable<E>
iterator
in interface Collection<E>
iterator
in class AbstractCollection<E>
public final int size()
IMPLEMENTATION NOTES:
This is an O(n) operation as we run through all the nodes and count them.
size
in interface Collection<E>
size
in class AbstractCollection<E>
Collection.size()
public final boolean isEmpty()
IMPLEMENTATION NOTES:
Queue is empty when producerNode is the same as consumerNode. An alternative implementation would be to observe
the producerNode.value is null, which also means an empty queue because only the consumerNode.value is allowed to
be null.
isEmpty
in interface Collection<E>
isEmpty
in class AbstractCollection<E>
MessagePassingQueue.isEmpty()
protected final void spConsumerNode(org.jctools.queues.LinkedQueueNode<E> node)
protected final org.jctools.queues.LinkedQueueNode<E> lvConsumerNode()
protected final org.jctools.queues.LinkedQueueNode<E> lpConsumerNode()
protected final void spProducerNode(org.jctools.queues.LinkedQueueNode<E> node)
protected final org.jctools.queues.LinkedQueueNode<E> lvProducerNode()
protected final org.jctools.queues.LinkedQueueNode<E> lpProducerNode()
Copyright © 2013-2016. All Rights Reserved.