Package org.jctools.queues
Class SpscOffHeapIntQueue
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final long
private final ByteBuffer
private final int
static final byte
private final long
private final long
static final int
private final int
static final byte
private final long
private 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 long
calcElementOffset
(long currentHead) private long
getHead()
private long
private long
static int
getRequiredBufferSize
(int capacity) private long
getTail()
private long
private long
boolean
isEmpty()
iterator()
boolean
boolean
offerInt
(int e) peek()
int
peekInt()
poll()
int
pollInt()
private void
setHead
(long value) private void
setHeadCache
(long value) private void
setTail
(long value) private void
setTailCache
(long value) int
size()
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
-
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:
size
in interfaceCollection<Integer>
- Specified by:
size
in classAbstractCollection<Integer>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceCollection<Integer>
- Overrides:
isEmpty
in classAbstractCollection<Integer>
-
iterator
- Specified by:
iterator
in interfaceCollection<Integer>
- Specified by:
iterator
in interfaceIterable<Integer>
- Specified by:
iterator
in classAbstractCollection<Integer>
-
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)
-