public class NetworkBufferPool extends Object implements BufferPoolFactory
MemorySegment
instances
for the network stack.
The NetworkBufferPool creates LocalBufferPool
s 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.
Constructor and Description |
---|
NetworkBufferPool(int numberOfSegmentsToAllocate,
int segmentSize)
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,
Optional<BufferPoolOwner> owner)
Tries to create a buffer pool with an optional 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.
|
int |
getMemorySegmentSize() |
int |
getNumberOfAvailableMemorySegments() |
int |
getNumberOfRegisteredBufferPools() |
int |
getTotalNumberOfMemorySegments() |
boolean |
isDestroyed() |
void |
recycle(MemorySegment segment) |
void |
recycleMemorySegments(List<MemorySegment> segments) |
MemorySegment |
requestMemorySegment() |
List<MemorySegment> |
requestMemorySegments(int numRequiredBuffers) |
public NetworkBufferPool(int numberOfSegmentsToAllocate, int segmentSize)
MemorySegment
instances managed by this pool.@Nullable public MemorySegment requestMemorySegment()
public void recycle(MemorySegment segment)
public List<MemorySegment> requestMemorySegments(int numRequiredBuffers) throws IOException
IOException
public void recycleMemorySegments(List<MemorySegment> segments) throws IOException
IOException
public void destroy()
public boolean isDestroyed()
public int getMemorySegmentSize()
public int getTotalNumberOfMemorySegments()
public int getNumberOfAvailableMemorySegments()
public int getNumberOfRegisteredBufferPools()
public int countBuffers()
public BufferPool createBufferPool(int numRequiredBuffers, int maxUsedBuffers) throws IOException
BufferPoolFactory
The buffer pool is of dynamic size with at least numRequiredBuffers buffers.
createBufferPool
in interface BufferPoolFactory
numRequiredBuffers
- minimum number of network buffers in this poolmaxUsedBuffers
- maximum number of network buffers this pool offersIOException
public BufferPool createBufferPool(int numRequiredBuffers, int maxUsedBuffers, Optional<BufferPoolOwner> owner) throws IOException
BufferPoolFactory
The buffer pool is of dynamic size with at least numRequiredBuffers buffers.
createBufferPool
in interface BufferPoolFactory
numRequiredBuffers
- minimum number of network buffers in this poolmaxUsedBuffers
- maximum number of network buffers this pool offersowner
- the optional owner of this buffer pool to release memory when neededIOException
public void destroyBufferPool(BufferPool bufferPool) throws IOException
BufferPoolFactory
destroyBufferPool
in interface BufferPoolFactory
IOException
public void destroyAllBufferPools()
createBufferPool(int, int)
).Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.