Class SpscOffHeapIntQueue

All Implemented Interfaces:
Iterable<Integer>, Collection<Integer>, Queue<Integer>

public final class SpscOffHeapIntQueue extends AbstractQueue<Integer>
  • 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

      private final ByteBuffer 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

      public 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.
      Parameters:
      buff -
      capacity -
      viewMask -
  • Method Details

    • getRequiredBufferSize

      public static int getRequiredBufferSize(int capacity)
    • offer

      public boolean offer(Integer e)
    • offerInt

      public boolean offerInt(int e)
    • poll

      public Integer poll()
    • pollInt

      public int pollInt()
    • calcElementOffset

      private long calcElementOffset(long currentHead)
    • peek

      public Integer peek()
    • peekInt

      public int peekInt()
    • size

      public int size()
      Specified by:
      size in interface Collection<Integer>
      Specified by:
      size in class AbstractCollection<Integer>
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface Collection<Integer>
      Overrides:
      isEmpty in class AbstractCollection<Integer>
    • iterator

      public Iterator<Integer> iterator()
      Specified by:
      iterator in interface Collection<Integer>
      Specified by:
      iterator in interface Iterable<Integer>
      Specified by:
      iterator in class AbstractCollection<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)