Interface BufferProvider
- All Superinterfaces:
AvailabilityProvider
- All Known Subinterfaces:
BufferPool
- All Known Implementing Classes:
LocalBufferPool
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
Modifier and TypeMethodDescriptionbooleanaddBufferListener(BufferListener listener) Adds a buffer availability listener to the buffer provider.booleanReturns whether the buffer provider has been destroyed.Returns aBufferinstance from the buffer provider, if one is available.Returns aBufferBuilderinstance from the buffer provider.requestBufferBuilder(int targetChannel) Returns aBufferBuilderinstance from the buffer provider.Returns aBufferBuilderinstance from the buffer provider.requestBufferBuilderBlocking(int targetChannel) Returns aBufferBuilderinstance from the buffer provider.org.apache.flink.core.memory.MemorySegmentReturns aMemorySegmentinstance from the buffer provider.org.apache.flink.core.memory.MemorySegmentReturns aMemorySegmentinstance from the buffer provider.Methods inherited from interface org.apache.flink.runtime.io.AvailabilityProvider
getAvailableFuture, isApproximatelyAvailable, isAvailable
-
Method Details
-
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
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
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
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
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
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
-