Class PoolSubpage<T>

java.lang.Object
io.netty.buffer.PoolSubpage<T>
All Implemented Interfaces:
PoolSubpageMetric

final class PoolSubpage<T> extends java.lang.Object implements PoolSubpageMetric
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final long[]
     
    private final int
     
    (package private) final PoolChunk<T>
     
    (package private) boolean
     
    (package private) final int
     
    (package private) final int
     
    (package private) final java.util.concurrent.locks.ReentrantLock
     
    private final int
     
    (package private) PoolSubpage<T>
     
    private int
     
    private int
     
    private final int
     
    (package private) PoolSubpage<T>
     
    private final int
     
    private final int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    PoolSubpage(int headIndex)
    Special constructor that creates a linked list head
    PoolSubpage(PoolSubpage<T> head, PoolChunk<T> chunk, int pageShifts, int runOffset, int runSize, int elemSize)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    private void
     
    (package private) long
    Returns the bitmap index of the subpage allocation.
    (package private) void
     
    int
    Return the size (in bytes) of the elements that will be allocated.
    private int
     
    private int
    findNextAvail0(int i, long bits)
     
    (package private) boolean
    free(PoolSubpage<T> head, int bitmapIdx)
     
    private int
     
    (package private) boolean
     
    (package private) void
     
    int
    Return the number of maximal elements that can be allocated out of the sub-page.
    int
    Return the number of available elements to be allocated.
    int
    Return the page size (in bytes) of this page.
    private void
     
    private void
    setNextAvail(int bitmapIdx)
     
    private long
    toHandle(int bitmapIdx)
     
    java.lang.String
     
    (package private) void
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • chunk

      final PoolChunk<T> chunk
    • elemSize

      final int elemSize
    • pageShifts

      private final int pageShifts
    • runOffset

      private final int runOffset
    • runSize

      private final int runSize
    • bitmap

      private final long[] bitmap
    • bitmapLength

      private final int bitmapLength
    • maxNumElems

      private final int maxNumElems
    • headIndex

      final int headIndex
    • prev

      PoolSubpage<T> prev
    • next

      PoolSubpage<T> next
    • doNotDestroy

      boolean doNotDestroy
    • nextAvail

      private int nextAvail
    • numAvail

      private int numAvail
    • lock

      final java.util.concurrent.locks.ReentrantLock lock
  • Constructor Details

    • PoolSubpage

      PoolSubpage(int headIndex)
      Special constructor that creates a linked list head
    • PoolSubpage

      PoolSubpage(PoolSubpage<T> head, PoolChunk<T> chunk, int pageShifts, int runOffset, int runSize, int elemSize)
  • Method Details

    • allocate

      long allocate()
      Returns the bitmap index of the subpage allocation.
    • free

      boolean free(PoolSubpage<T> head, int bitmapIdx)
      Returns:
      true if this subpage is in use. false if this subpage is not used by its chunk and thus it's OK to be released.
    • addToPool

      private void addToPool(PoolSubpage<T> head)
    • removeFromPool

      private void removeFromPool()
    • setNextAvail

      private void setNextAvail(int bitmapIdx)
    • getNextAvail

      private int getNextAvail()
    • findNextAvail

      private int findNextAvail()
    • findNextAvail0

      private int findNextAvail0(int i, long bits)
    • toHandle

      private long toHandle(int bitmapIdx)
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object
    • maxNumElements

      public int maxNumElements()
      Description copied from interface: PoolSubpageMetric
      Return the number of maximal elements that can be allocated out of the sub-page.
      Specified by:
      maxNumElements in interface PoolSubpageMetric
    • numAvailable

      public int numAvailable()
      Description copied from interface: PoolSubpageMetric
      Return the number of available elements to be allocated.
      Specified by:
      numAvailable in interface PoolSubpageMetric
    • elementSize

      public int elementSize()
      Description copied from interface: PoolSubpageMetric
      Return the size (in bytes) of the elements that will be allocated.
      Specified by:
      elementSize in interface PoolSubpageMetric
    • pageSize

      public int pageSize()
      Description copied from interface: PoolSubpageMetric
      Return the page size (in bytes) of this page.
      Specified by:
      pageSize in interface PoolSubpageMetric
    • isDoNotDestroy

      boolean isDoNotDestroy()
    • destroy

      void destroy()
    • lock

      void lock()
    • unlock

      void unlock()