Package rx.internal.util.unsafe
Class SpmcArrayQueue<E>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractQueue<E>
rx.internal.util.unsafe.ConcurrentCircularArrayQueueL0Pad<E>
rx.internal.util.unsafe.ConcurrentCircularArrayQueue<E>
rx.internal.util.unsafe.SpmcArrayQueueL1Pad<E>
rx.internal.util.unsafe.SpmcArrayQueueProducerField<E>
rx.internal.util.unsafe.SpmcArrayQueueL2Pad<E>
rx.internal.util.unsafe.SpmcArrayQueueConsumerField<E>
rx.internal.util.unsafe.SpmcArrayQueueMidPad<E>
rx.internal.util.unsafe.SpmcArrayQueueProducerIndexCacheField<E>
rx.internal.util.unsafe.SpmcArrayQueueL3Pad<E>
rx.internal.util.unsafe.SpmcArrayQueue<E>
- All Implemented Interfaces:
Iterable<E>
,Collection<E>
,Queue<E>
,MessagePassingQueue<E>
-
Field Summary
Fields inherited from class rx.internal.util.unsafe.SpmcArrayQueueL3Pad
p30, p31, p32, p33, p34, p35, p36, p37, p40, p41, p42, p43, p44, p45, p46
Fields inherited from class rx.internal.util.unsafe.SpmcArrayQueueMidPad
p20, p21, p22, p23, p24, p25, p26
Fields inherited from class rx.internal.util.unsafe.SpmcArrayQueueConsumerField
C_INDEX_OFFSET
Fields inherited from class rx.internal.util.unsafe.SpmcArrayQueueProducerField
P_INDEX_OFFSET
Fields inherited from class rx.internal.util.unsafe.SpmcArrayQueueL1Pad
p10, p11, p12, p13, p14, p15, p16
Fields inherited from class rx.internal.util.unsafe.ConcurrentCircularArrayQueue
buffer, BUFFER_PAD, mask, SPARSE_SHIFT
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
isEmpty()
This method's accuracy is subject to concurrent modifications happening as the observation is carried out.boolean
Called from a producer thread subject to the restrictions appropriate to the implementation and according to theQueue.offer(Object)
interface.peek()
Called from the consumer thread subject to the restrictions appropriate to the implementation and according to theQueue.peek()
interface.poll()
Called from the consumer thread subject to the restrictions appropriate to the implementation and according to theQueue.poll()
interface.int
size()
This method's accuracy is subject to concurrent modifications happening as the size is estimated and as such is a best effort rather than absolute value.Methods inherited from class rx.internal.util.unsafe.SpmcArrayQueueProducerIndexCacheField
lvProducerIndexCache, svProducerIndexCache
Methods inherited from class rx.internal.util.unsafe.SpmcArrayQueueConsumerField
casHead, lvConsumerIndex
Methods inherited from class rx.internal.util.unsafe.SpmcArrayQueueProducerField
lvProducerIndex, soTail
Methods inherited from class rx.internal.util.unsafe.ConcurrentCircularArrayQueue
calcElementOffset, calcElementOffset, clear, iterator, lpElement, lpElement, lvElement, lvElement, soElement, soElement, spElement, spElement
Methods inherited from class java.util.AbstractQueue
add, addAll, element, remove
Methods inherited from class java.util.AbstractCollection
contains, containsAll, remove, removeAll, retainAll, toArray, toArray, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
contains, containsAll, equals, hashCode, parallelStream, remove, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArray, toArray
-
Constructor Details
-
SpmcArrayQueue
public SpmcArrayQueue(int capacity)
-
-
Method Details
-
offer
Description copied from interface:MessagePassingQueue
Called from a producer thread subject to the restrictions appropriate to the implementation and according to theQueue.offer(Object)
interface.- Parameters:
e
-- Returns:
- true if element was inserted into the queue, false iff full
-
poll
Description copied from interface:MessagePassingQueue
Called from the consumer thread subject to the restrictions appropriate to the implementation and according to theQueue.poll()
interface.- Returns:
- a message from the queue if one is available, null iff empty
-
peek
Description copied from interface:MessagePassingQueue
Called from the consumer thread subject to the restrictions appropriate to the implementation and according to theQueue.peek()
interface.- Returns:
- a message from the queue if one is available, null iff empty
-
size
public int size()Description copied from interface:MessagePassingQueue
This method's accuracy is subject to concurrent modifications happening as the size is estimated and as such is a best effort rather than absolute value. For some implementations this method may be O(n) rather than O(1).- Specified by:
size
in interfaceCollection<E>
- Specified by:
size
in interfaceMessagePassingQueue<E>
- Specified by:
size
in classAbstractCollection<E>
- Returns:
- number of messages in the queue, between 0 and queue capacity or
Integer.MAX_VALUE
if not bounded
-
isEmpty
public boolean isEmpty()Description copied from interface:MessagePassingQueue
This method's accuracy is subject to concurrent modifications happening as the observation is carried out.- Specified by:
isEmpty
in interfaceCollection<E>
- Specified by:
isEmpty
in interfaceMessagePassingQueue<E>
- Overrides:
isEmpty
in classAbstractCollection<E>
- Returns:
- true if empty, false otherwise
-