public final class SpscOffHeapIntQueue
extends java.util.AbstractQueue<java.lang.Integer>
Modifier and Type | Field and Description |
---|---|
private long |
arrayBase |
private java.nio.ByteBuffer |
buffy |
private int |
capacity |
static byte |
CONSUMER |
private long |
headAddress |
private long |
headCacheAddress |
static int |
INT_ELEMENT_SCALE |
private int |
mask |
static byte |
PRODUCER |
private long |
tailAddress |
private long |
tailCacheAddress |
Constructor and Description |
---|
SpscOffHeapIntQueue(java.nio.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.
|
SpscOffHeapIntQueue(int capacity) |
Modifier and Type | Method and Description |
---|---|
private long |
calcElementOffset(long currentHead) |
private long |
getHead() |
private long |
getHeadCache() |
private long |
getHeadPlain() |
static int |
getRequiredBufferSize(int capacity) |
private long |
getTail() |
private long |
getTailCache() |
private long |
getTailPlain() |
boolean |
isEmpty() |
java.util.Iterator<java.lang.Integer> |
iterator() |
boolean |
offer(java.lang.Integer e) |
boolean |
offerInt(int e) |
java.lang.Integer |
peek() |
int |
peekInt() |
java.lang.Integer |
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() |
contains, containsAll, remove, removeAll, retainAll, toArray, toArray, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public static final byte PRODUCER
public static final byte CONSUMER
public static final int INT_ELEMENT_SCALE
private final java.nio.ByteBuffer buffy
private final long headAddress
private final long tailCacheAddress
private final long tailAddress
private final long headCacheAddress
private final int capacity
private final int mask
private final long arrayBase
public SpscOffHeapIntQueue(int capacity)
public SpscOffHeapIntQueue(java.nio.ByteBuffer buff, int capacity, byte viewMask)
buff
- capacity
- viewMask
- public static int getRequiredBufferSize(int capacity)
public boolean offer(java.lang.Integer e)
public boolean offerInt(int e)
public java.lang.Integer poll()
public int pollInt()
private long calcElementOffset(long currentHead)
public java.lang.Integer peek()
public int peekInt()
public int size()
size
in interface java.util.Collection<java.lang.Integer>
size
in class java.util.AbstractCollection<java.lang.Integer>
public boolean isEmpty()
isEmpty
in interface java.util.Collection<java.lang.Integer>
isEmpty
in class java.util.AbstractCollection<java.lang.Integer>
public java.util.Iterator<java.lang.Integer> iterator()
iterator
in interface java.lang.Iterable<java.lang.Integer>
iterator
in interface java.util.Collection<java.lang.Integer>
iterator
in class java.util.AbstractCollection<java.lang.Integer>
private long getHeadPlain()
private long getHead()
private void setHead(long value)
private long getTailPlain()
private long getTail()
private void setTail(long value)
private long getHeadCache()
private void setHeadCache(long value)
private long getTailCache()
private void setTailCache(long value)