Package kilim.concurrent
Class MPSCQueue<E>
- java.lang.Object
-
public class MPSCQueue<E> extends MPSCQueueL3Pad<E>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMPSCQueue.BackOffStrategy
-
Field Summary
Fields Modifier and Type Field Description private static MPSCQueue.BackOffStrategyCAS_BACKOFF-
Fields inherited from class kilim.concurrent.MPSCQueueL3Pad
ARRAY_BASE, ELEMENT_SHIFT, HEAD_OFFSET, p30, p31, p32, p33, p34, p35, p36, p37, p40, p41, p42, p43, p44, p45, p46, TAIL_OFFSET
-
Fields inherited from class kilim.concurrent.MPSCQueueHeadField
head
-
Fields inherited from class kilim.concurrent.MPSCQueueTailField
tail
-
Fields inherited from class kilim.concurrent.MPSCQueueColdFields
buffer, BUFFER_PAD, capacity, mask, SPARSE_SHIFT
-
-
Constructor Summary
Constructors Constructor Description MPSCQueue(int capacity)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(E e)private booleancasTail(long expect, long newValue)Eelement()private longelementOffsetInBuffer(long index)voidfill(E[] buf)private EgetElement(long index)private longgetHead()private longgetTail()booleanhasSpace()booleanisEmpty()private voidlazySetHead(long l)booleanoffer(E e)Epeek()Epoll()Eremove()intsize()-
Methods inherited from class kilim.concurrent.MPSCQueueColdFields
findNextPositivePowerOfTwo, isPowerOf2
-
-
-
-
Field Detail
-
CAS_BACKOFF
private static final MPSCQueue.BackOffStrategy CAS_BACKOFF
-
-
Method Detail
-
getHead
private long getHead()
-
lazySetHead
private void lazySetHead(long l)
-
getTail
private long getTail()
-
casTail
private boolean casTail(long expect, long newValue)
-
add
public boolean add(E e)
-
elementOffsetInBuffer
private long elementOffsetInBuffer(long index)
-
offer
public boolean offer(E e)
-
hasSpace
public boolean hasSpace()
-
poll
public E poll()
-
fill
public void fill(E[] buf)
-
remove
public E remove()
-
isEmpty
public boolean isEmpty()
-
element
public E element()
-
peek
public E peek()
-
getElement
private E getElement(long index)
-
size
public int size()
-
-