Class BufferManager
- 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 byInputChannelto request/recycle exclusive or floating buffers.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.flink.runtime.io.network.buffer.BufferRecycler
BufferRecycler.DummyBufferRecycler
-
-
Constructor Summary
Constructors Constructor Description BufferManager(org.apache.flink.core.memory.MemorySegmentProvider globalPool, InputChannel inputChannel, int numRequiredBuffers)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleannotifyBufferAvailable(Buffer buffer)The buffer pool notifies this listener of an available floating buffer.voidnotifyBufferDestroyed()Notification callback if the buffer provider is destroyed.voidrecycle(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.
-
-
-
Constructor Detail
-
BufferManager
public BufferManager(org.apache.flink.core.memory.MemorySegmentProvider globalPool, InputChannel inputChannel, int numRequiredBuffers)
-
-
Method Detail
-
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:
recyclein interfaceBufferRecycler- 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:
notifyBufferAvailablein interfaceBufferListener- 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:BufferListenerNotification callback if the buffer provider is destroyed.- Specified by:
notifyBufferDestroyedin interfaceBufferListener
-
-