Package kilim.concurrent
Class SPSCQueue<T>
- java.lang.Object
-
- kilim.concurrent.SPSCQueue<T>
-
public class SPSCQueue<T> extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSPSCQueue.PaddedLong
-
Field Summary
Fields Modifier and Type Field Description protected T[]bufferVolatileLongCellheadprotected SPSCQueue.PaddedLongheadCacheprotected intmaskVolatileLongCelltailprotected SPSCQueue.PaddedLongtailCache
-
Constructor Summary
Constructors Constructor Description SPSCQueue(int initialSize)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanfillnb(T[] msg)static intfindNextPositivePowerOfTwo(int value)booleanhasSpace()booleanisEmpty()booleanoffer(T msg)Tpoll()voidputMailbox(T[] buf, MailboxSPSC mb)intsize()
-
-
-
Field Detail
-
buffer
protected T[] buffer
-
tail
public final VolatileLongCell tail
-
head
public final VolatileLongCell head
-
mask
protected final int mask
-
tailCache
protected final SPSCQueue.PaddedLong tailCache
-
headCache
protected final SPSCQueue.PaddedLong headCache
-
-
Method Detail
-
findNextPositivePowerOfTwo
public static int findNextPositivePowerOfTwo(int value)
-
poll
public T poll()
-
offer
public boolean offer(T msg)
-
putMailbox
public void putMailbox(T[] buf, MailboxSPSC mb) throws Pausable
- Throws:
Pausable
-
fillnb
public boolean fillnb(T[] msg)
-
isEmpty
public boolean isEmpty()
-
hasSpace
public boolean hasSpace()
-
size
public int size()
-
-