Class NettyBufferPool

java.lang.Object
org.apache.flink.shaded.netty4.io.netty.buffer.AbstractByteBufAllocator
org.apache.flink.shaded.netty4.io.netty.buffer.PooledByteBufAllocator
org.apache.flink.runtime.io.network.netty.NettyBufferPool
All Implemented Interfaces:
org.apache.flink.shaded.netty4.io.netty.buffer.ByteBufAllocator, org.apache.flink.shaded.netty4.io.netty.buffer.ByteBufAllocatorMetricProvider

public class NettyBufferPool extends org.apache.flink.shaded.netty4.io.netty.buffer.PooledByteBufAllocator
Extends around Netty's PooledByteBufAllocator with strict control over the number of created arenas.
  • Field Summary

    Fields inherited from class org.apache.flink.shaded.netty4.io.netty.buffer.PooledByteBufAllocator

    DEFAULT
  • Constructor Summary

    Constructors
    Constructor
    Description
    NettyBufferPool(int numberOfArenas)
    Creates Netty's buffer pool with the specified number of direct arenas.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.apache.flink.shaded.netty4.io.netty.buffer.CompositeByteBuf
     
    org.apache.flink.shaded.netty4.io.netty.buffer.CompositeByteBuf
    compositeHeapBuffer(int maxNumComponents)
     
    Returns the number of currently allocated bytes.
    org.apache.flink.shaded.netty4.io.netty.buffer.ByteBuf
     
    org.apache.flink.shaded.netty4.io.netty.buffer.ByteBuf
    heapBuffer(int initialCapacity)
     
    org.apache.flink.shaded.netty4.io.netty.buffer.ByteBuf
    heapBuffer(int initialCapacity, int maxCapacity)
     

    Methods inherited from class org.apache.flink.shaded.netty4.io.netty.buffer.PooledByteBufAllocator

    chunkSize, defaultMaxOrder, defaultNormalCacheSize, defaultNumDirectArena, defaultNumHeapArena, defaultPageSize, defaultPreferDirect, defaultSmallCacheSize, defaultTinyCacheSize, defaultUseCacheForAllThreads, directArenas, dumpStats, freeThreadLocalCache, hasThreadLocalCache, heapArenas, isDirectBufferPooled, isDirectMemoryCacheAlignmentSupported, metric, newDirectBuffer, newHeapBuffer, normalCacheSize, numDirectArenas, numHeapArenas, numThreadLocalCaches, pinnedDirectMemory, pinnedHeapMemory, smallCacheSize, tinyCacheSize, trimCurrentThreadCache

    Methods inherited from class org.apache.flink.shaded.netty4.io.netty.buffer.AbstractByteBufAllocator

    buffer, buffer, buffer, calculateNewCapacity, compositeBuffer, compositeBuffer, compositeDirectBuffer, compositeDirectBuffer, directBuffer, directBuffer, directBuffer, ioBuffer, ioBuffer, ioBuffer, toLeakAwareBuffer, toLeakAwareBuffer, toString

    Methods inherited from class java.lang.Object

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

    • NettyBufferPool

      public NettyBufferPool(int numberOfArenas)
      Creates Netty's buffer pool with the specified number of direct arenas.
      Parameters:
      numberOfArenas - Number of arenas (recommended: 2 * number of task slots)
  • Method Details

    • getNumberOfAllocatedBytes

      public Optional<Long> getNumberOfAllocatedBytes() throws NoSuchFieldException, IllegalAccessException
      Returns the number of currently allocated bytes.

      The stats are gathered via Reflection and are mostly relevant for debugging purposes.

      Returns:
      Number of currently allocated bytes.
      Throws:
      NoSuchFieldException - Error getting the statistics (should not happen when the Netty version stays the same).
      IllegalAccessException - Error getting the statistics (should not happen when the Netty version stays the same).
    • heapBuffer

      public org.apache.flink.shaded.netty4.io.netty.buffer.ByteBuf heapBuffer()
      Specified by:
      heapBuffer in interface org.apache.flink.shaded.netty4.io.netty.buffer.ByteBufAllocator
      Overrides:
      heapBuffer in class org.apache.flink.shaded.netty4.io.netty.buffer.AbstractByteBufAllocator
    • heapBuffer

      public org.apache.flink.shaded.netty4.io.netty.buffer.ByteBuf heapBuffer(int initialCapacity)
      Specified by:
      heapBuffer in interface org.apache.flink.shaded.netty4.io.netty.buffer.ByteBufAllocator
      Overrides:
      heapBuffer in class org.apache.flink.shaded.netty4.io.netty.buffer.AbstractByteBufAllocator
    • heapBuffer

      public org.apache.flink.shaded.netty4.io.netty.buffer.ByteBuf heapBuffer(int initialCapacity, int maxCapacity)
      Specified by:
      heapBuffer in interface org.apache.flink.shaded.netty4.io.netty.buffer.ByteBufAllocator
      Overrides:
      heapBuffer in class org.apache.flink.shaded.netty4.io.netty.buffer.AbstractByteBufAllocator
    • compositeHeapBuffer

      public org.apache.flink.shaded.netty4.io.netty.buffer.CompositeByteBuf compositeHeapBuffer()
      Specified by:
      compositeHeapBuffer in interface org.apache.flink.shaded.netty4.io.netty.buffer.ByteBufAllocator
      Overrides:
      compositeHeapBuffer in class org.apache.flink.shaded.netty4.io.netty.buffer.AbstractByteBufAllocator
    • compositeHeapBuffer

      public org.apache.flink.shaded.netty4.io.netty.buffer.CompositeByteBuf compositeHeapBuffer(int maxNumComponents)
      Specified by:
      compositeHeapBuffer in interface org.apache.flink.shaded.netty4.io.netty.buffer.ByteBufAllocator
      Overrides:
      compositeHeapBuffer in class org.apache.flink.shaded.netty4.io.netty.buffer.AbstractByteBufAllocator