public class NetworkBufferPool extends Object implements BufferPoolFactory, org.apache.flink.core.memory.MemorySegmentProvider, AvailabilityProvider
MemorySegment instances
for the network stack.
The NetworkBufferPool creates LocalBufferPools from which the individual tasks draw
the buffers for the network data transfer. When new local buffer pools are created, the
NetworkBufferPool dynamically redistributes the buffers between the pools.
AvailabilityProvider.AvailabilityHelperAVAILABLE| Constructor and Description |
|---|
NetworkBufferPool(int numberOfSegmentsToAllocate,
int segmentSize,
int numberOfSegmentsToRequest) |
NetworkBufferPool(int numberOfSegmentsToAllocate,
int segmentSize,
int numberOfSegmentsToRequest,
java.time.Duration requestSegmentsTimeout)
Allocates all
MemorySegment instances managed by this pool. |
| Modifier and Type | Method and Description |
|---|---|
int |
countBuffers() |
BufferPool |
createBufferPool(int numRequiredBuffers,
int maxUsedBuffers)
Tries to create a buffer pool, which is guaranteed to provide at least the number of required
buffers.
|
BufferPool |
createBufferPool(int numRequiredBuffers,
int maxUsedBuffers,
BufferPoolOwner bufferPoolOwner)
Tries to create a buffer pool with an owner, which is guaranteed to provide at least the
number of required buffers.
|
void |
destroy() |
void |
destroyAllBufferPools()
Destroys all buffer pools that allocate their buffers from this
buffer pool (created via
createBufferPool(int, int)). |
void |
destroyBufferPool(BufferPool bufferPool)
Destroy callback for updating factory book keeping.
|
CompletableFuture<?> |
getAvailableFuture()
Returns a future that is completed when there are free segments
in this pool.
|
int |
getNumberOfAvailableMemorySegments() |
int |
getNumberOfRegisteredBufferPools() |
int |
getTotalNumberOfMemorySegments() |
boolean |
isDestroyed() |
void |
recycle(org.apache.flink.core.memory.MemorySegment segment) |
void |
recycleMemorySegments(Collection<org.apache.flink.core.memory.MemorySegment> segments) |
org.apache.flink.core.memory.MemorySegment |
requestMemorySegment() |
List<org.apache.flink.core.memory.MemorySegment> |
requestMemorySegments() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitisApproximatelyAvailable, isAvailable@VisibleForTesting
public NetworkBufferPool(int numberOfSegmentsToAllocate,
int segmentSize,
int numberOfSegmentsToRequest)
public NetworkBufferPool(int numberOfSegmentsToAllocate,
int segmentSize,
int numberOfSegmentsToRequest,
java.time.Duration requestSegmentsTimeout)
MemorySegment instances managed by this pool.@Nullable public org.apache.flink.core.memory.MemorySegment requestMemorySegment()
public void recycle(org.apache.flink.core.memory.MemorySegment segment)
public List<org.apache.flink.core.memory.MemorySegment> requestMemorySegments() throws IOException
requestMemorySegments in interface org.apache.flink.core.memory.MemorySegmentProviderIOExceptionpublic void recycleMemorySegments(Collection<org.apache.flink.core.memory.MemorySegment> segments) throws IOException
recycleMemorySegments in interface org.apache.flink.core.memory.MemorySegmentProviderIOExceptionpublic void destroy()
public boolean isDestroyed()
public int getTotalNumberOfMemorySegments()
public int getNumberOfAvailableMemorySegments()
public int getNumberOfRegisteredBufferPools()
public int countBuffers()
public CompletableFuture<?> getAvailableFuture()
getAvailableFuture in interface AvailabilityProviderpublic BufferPool createBufferPool(int numRequiredBuffers, int maxUsedBuffers) throws IOException
BufferPoolFactoryThe buffer pool is of dynamic size with at least numRequiredBuffers buffers.
createBufferPool in interface BufferPoolFactorynumRequiredBuffers - minimum number of network buffers in this poolmaxUsedBuffers - maximum number of network buffers this pool offersIOExceptionpublic BufferPool createBufferPool(int numRequiredBuffers, int maxUsedBuffers, BufferPoolOwner bufferPoolOwner) throws IOException
BufferPoolFactoryThe buffer pool is of dynamic size with at least numRequiredBuffers buffers.
createBufferPool in interface BufferPoolFactorynumRequiredBuffers - minimum number of network buffers in this poolmaxUsedBuffers - maximum number of network buffers this pool offersbufferPoolOwner - the owner of this buffer pool to release memory when neededIOExceptionpublic void destroyBufferPool(BufferPool bufferPool) throws IOException
BufferPoolFactorydestroyBufferPool in interface BufferPoolFactoryIOExceptionpublic void destroyAllBufferPools()
createBufferPool(int, int)).Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.