Class SpscOffHeapIntQueue
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final longprivate final ByteBufferprivate final intstatic final byteprivate final longprivate final longstatic final intprivate final intstatic final byteprivate final longprivate final long -
Constructor Summary
ConstructorsConstructorDescriptionSpscOffHeapIntQueue(int capacity) SpscOffHeapIntQueue(ByteBuffer buff, int capacity, byte viewMask) This is to be used for an IPC queue with the direct buffer used being a memory mapped file. -
Method Summary
Modifier and TypeMethodDescriptionprivate longcalcElementOffset(long currentHead) private longgetHead()private longprivate longstatic intgetRequiredBufferSize(int capacity) private longgetTail()private longprivate longbooleanisEmpty()iterator()booleanbooleanofferInt(int e) peek()intpeekInt()poll()intpollInt()private voidsetHead(long value) private voidsetHeadCache(long value) private voidsetTail(long value) private voidsetTailCache(long value) intsize()Methods inherited from class AbstractCollection
contains, containsAll, remove, removeAll, retainAll, toArray, toArray, toStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface Collection
contains, containsAll, equals, hashCode, parallelStream, remove, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArray, toArray
-
Field Details
-
PRODUCER
public static final byte PRODUCER- See Also:
-
CONSUMER
public static final byte CONSUMER- See Also:
-
INT_ELEMENT_SCALE
public static final int INT_ELEMENT_SCALE -
buffy
-
headAddress
private final long headAddress -
tailCacheAddress
private final long tailCacheAddress -
tailAddress
private final long tailAddress -
headCacheAddress
private final long headCacheAddress -
capacity
private final int capacity -
mask
private final int mask -
arrayBase
private final long arrayBase
-
-
Constructor Details
-
SpscOffHeapIntQueue
public SpscOffHeapIntQueue(int capacity) -
SpscOffHeapIntQueue
This is to be used for an IPC queue with the direct buffer used being a memory mapped file.- Parameters:
buff-capacity-viewMask-
-
-
Method Details
-
getRequiredBufferSize
public static int getRequiredBufferSize(int capacity) -
offer
-
offerInt
public boolean offerInt(int e) -
poll
-
pollInt
public int pollInt() -
calcElementOffset
private long calcElementOffset(long currentHead) -
peek
-
peekInt
public int peekInt() -
size
public int size()- Specified by:
sizein interfaceCollection<Integer>- Specified by:
sizein classAbstractCollection<Integer>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceCollection<Integer>- Overrides:
isEmptyin classAbstractCollection<Integer>
-
iterator
-
getHeadPlain
private long getHeadPlain() -
getHead
private long getHead() -
setHead
private void setHead(long value) -
getTailPlain
private long getTailPlain() -
getTail
private long getTail() -
setTail
private void setTail(long value) -
getHeadCache
private long getHeadCache() -
setHeadCache
private void setHeadCache(long value) -
getTailCache
private long getTailCache() -
setTailCache
private void setTailCache(long value)
-