java.lang.Object
org.apache.flink.runtime.io.network.partition.consumer.BufferManager
All Implemented Interfaces:
BufferListener, BufferRecycler

public class BufferManager extends Object implements BufferListener, BufferRecycler
The general buffer manager used by InputChannel to request/recycle exclusive or floating buffers.
  • Constructor Details

    • BufferManager

      public BufferManager(org.apache.flink.core.memory.MemorySegmentProvider globalPool, InputChannel inputChannel, int numRequiredBuffers)
  • Method Details

    • recycle

      public void recycle(org.apache.flink.core.memory.MemorySegment segment)
      Exclusive buffer is recycled to this channel manager directly and it may trigger return extra floating buffer based on numRequiredBuffers.
      Specified by:
      recycle in interface BufferRecycler
      Parameters:
      segment - The exclusive segment of this channel.
    • notifyBufferAvailable

      public boolean notifyBufferAvailable(Buffer buffer)
      The buffer pool notifies this listener of an available floating buffer. If the listener is released or currently does not need extra buffers, the buffer should be returned to the buffer pool. Otherwise, the buffer will be added into the bufferQueue.
      Specified by:
      notifyBufferAvailable in interface BufferListener
      Parameters:
      buffer - Buffer that becomes available in buffer pool.
      Returns:
      true if the buffer is accepted by this listener.
    • notifyBufferDestroyed

      public void notifyBufferDestroyed()
      Description copied from interface: BufferListener
      Notification callback if the buffer provider is destroyed.
      Specified by:
      notifyBufferDestroyed in interface BufferListener