Class SpscOffHeapIntQueue

  • All Implemented Interfaces:
    java.lang.Iterable<java.lang.Integer>, java.util.Collection<java.lang.Integer>, java.util.Queue<java.lang.Integer>

    public final class SpscOffHeapIntQueue
    extends java.util.AbstractQueue<java.lang.Integer>
    • Constructor Summary

      Constructors 
      Constructor Description
      SpscOffHeapIntQueue​(int capacity)  
      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.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method 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()  
      • Methods inherited from class java.util.AbstractQueue

        add, addAll, clear, element, remove
      • 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
      • Methods inherited from interface java.lang.Iterable

        forEach
    • Field Detail

      • INT_ELEMENT_SCALE

        public static final int INT_ELEMENT_SCALE
      • buffy

        private final java.nio.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 Detail

      • SpscOffHeapIntQueue

        public SpscOffHeapIntQueue​(int capacity)
      • SpscOffHeapIntQueue

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

      • getRequiredBufferSize

        public static int getRequiredBufferSize​(int capacity)
      • offer

        public boolean offer​(java.lang.Integer e)
      • offerInt

        public boolean offerInt​(int e)
      • poll

        public java.lang.Integer poll()
      • pollInt

        public int pollInt()
      • calcElementOffset

        private long calcElementOffset​(long currentHead)
      • peek

        public java.lang.Integer peek()
      • peekInt

        public int peekInt()
      • size

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

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

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