Interface BufferProvider
-
- All Superinterfaces:
AvailabilityProvider
- All Known Subinterfaces:
BufferPool
- All Known Implementing Classes:
LocalBufferPool
public interface BufferProvider extends AvailabilityProvider
A buffer provider to request buffers from in a synchronous or asynchronous fashion.The data producing side (result partition writers) request buffers in a synchronous fashion, whereas the input side requests asynchronously.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.flink.runtime.io.AvailabilityProvider
AvailabilityProvider.AvailabilityHelper
-
-
Field Summary
-
Fields inherited from interface org.apache.flink.runtime.io.AvailabilityProvider
AVAILABLE
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanaddBufferListener(BufferListener listener)Adds a buffer availability listener to the buffer provider.booleanisDestroyed()Returns whether the buffer provider has been destroyed.BufferrequestBuffer()Returns aBufferinstance from the buffer provider, if one is available.BufferBuilderrequestBufferBuilder()Returns aBufferBuilderinstance from the buffer provider.BufferBuilderrequestBufferBuilder(int targetChannel)Returns aBufferBuilderinstance from the buffer provider.BufferBuilderrequestBufferBuilderBlocking()Returns aBufferBuilderinstance from the buffer provider.BufferBuilderrequestBufferBuilderBlocking(int targetChannel)Returns aBufferBuilderinstance from the buffer provider.org.apache.flink.core.memory.MemorySegmentrequestMemorySegment()Returns aMemorySegmentinstance from the buffer provider.org.apache.flink.core.memory.MemorySegmentrequestMemorySegmentBlocking()Returns aMemorySegmentinstance from the buffer provider.-
Methods inherited from interface org.apache.flink.runtime.io.AvailabilityProvider
getAvailableFuture, isApproximatelyAvailable, isAvailable
-
-
-
-
Method Detail
-
requestBuffer
@Nullable Buffer requestBuffer()
Returns aBufferinstance from the buffer provider, if one is available.- Returns:
nullif no buffer is available or the buffer provider has been destroyed.
-
requestBufferBuilder
@Nullable BufferBuilder requestBufferBuilder()
Returns aBufferBuilderinstance from the buffer provider. This equals torequestBufferBuilder(int)with unknown target channel.- Returns:
nullif no buffer is available or the buffer provider has been destroyed.
-
requestBufferBuilder
@Nullable BufferBuilder requestBufferBuilder(int targetChannel)
Returns aBufferBuilderinstance from the buffer provider.- Parameters:
targetChannel- to which the request will be accounted to.- Returns:
nullif no buffer is available or the buffer provider has been destroyed.
-
requestBufferBuilderBlocking
BufferBuilder requestBufferBuilderBlocking() throws InterruptedException
Returns aBufferBuilderinstance from the buffer provider. This equals torequestBufferBuilderBlocking(int)with unknown target channel.If there is no buffer available, the call will block until one becomes available again or the buffer provider has been destroyed.
- Throws:
InterruptedException
-
requestBufferBuilderBlocking
BufferBuilder requestBufferBuilderBlocking(int targetChannel) throws InterruptedException
Returns aBufferBuilderinstance from the buffer provider.If there is no buffer available, the call will block until one becomes available again or the buffer provider has been destroyed.
- Parameters:
targetChannel- to which the request will be accounted to.- Throws:
InterruptedException
-
addBufferListener
boolean addBufferListener(BufferListener listener)
Adds a buffer availability listener to the buffer provider.The operation fails with return value
false, when there is a buffer available or the buffer provider has been destroyed.
-
isDestroyed
boolean isDestroyed()
Returns whether the buffer provider has been destroyed.
-
requestMemorySegment
@Nullable org.apache.flink.core.memory.MemorySegment requestMemorySegment()
Returns aMemorySegmentinstance from the buffer provider.- Returns:
nullif no memory segment is available or the buffer provider has been destroyed.
-
requestMemorySegmentBlocking
org.apache.flink.core.memory.MemorySegment requestMemorySegmentBlocking() throws InterruptedExceptionReturns aMemorySegmentinstance from the buffer provider.If there is no memory segment available, the call will block until one becomes available again or the buffer provider has been destroyed.
- Throws:
InterruptedException
-
-