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:
java.lang.Iterable<E>,java.util.Collection<E>,java.util.Queue<E>,MessagePassingQueue<E>
@SuppressAnimalSniffer public final class SpmcArrayQueue<E> extends SpmcArrayQueueL3Pad<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 Constructor Description SpmcArrayQueue(int capacity)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisEmpty()This method's accuracy is subject to concurrent modifications happening as the observation is carried out.booleanoffer(E e)Called from a producer thread subject to the restrictions appropriate to the implementation and according to theQueue.offer(Object)interface.Epeek()Called from the consumer thread subject to the restrictions appropriate to the implementation and according to theQueue.peek()interface.Epoll()Called from the consumer thread subject to the restrictions appropriate to the implementation and according to theQueue.poll()interface.intsize()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.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
-
-
-
-
Method Detail
-
offer
public boolean offer(E e)
Description copied from interface:MessagePassingQueueCalled from a producer thread subject to the restrictions appropriate to the implementation and according to theQueue.offer(Object)interface.- Returns:
- true if element was inserted into the queue, false iff full
-
poll
public E poll()
Description copied from interface:MessagePassingQueueCalled 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
public E peek()
Description copied from interface:MessagePassingQueueCalled 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:MessagePassingQueueThis 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:
sizein interfacejava.util.Collection<E>- Specified by:
sizein interfaceMessagePassingQueue<E>- Specified by:
sizein classjava.util.AbstractCollection<E>- Returns:
- number of messages in the queue, between 0 and queue capacity or
Integer.MAX_VALUEif not bounded
-
isEmpty
public boolean isEmpty()
Description copied from interface:MessagePassingQueueThis method's accuracy is subject to concurrent modifications happening as the observation is carried out.- Specified by:
isEmptyin interfacejava.util.Collection<E>- Specified by:
isEmptyin interfaceMessagePassingQueue<E>- Overrides:
isEmptyin classjava.util.AbstractCollection<E>- Returns:
- true if empty, false otherwise
-
-