Package org.xnio
Class ByteBufferSlicePool
java.lang.Object
org.xnio.ByteBufferSlicePool
- All Implemented Interfaces:
Pool<ByteBuffer>
Deprecated.
A buffer pooled allocator. This pool uses a series of buffer regions to back the
returned pooled buffers. When the buffer is no longer needed, it should be freed back into the pool; failure
to do so will cause the corresponding buffer area to be unavailable until the buffer is garbage-collected.
If the buffer pool is no longer used, it is advisable to invoke
clean() to make
sure that direct allocated buffers can be reused by a future instance.- Author:
- David M. Lloyd, Flavia Rainone
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionByteBufferSlicePool(int bufferSize, int maxRegionSize) Deprecated.Construct a new instance, using a direct buffer allocator.ByteBufferSlicePool(BufferAllocator<ByteBuffer> allocator, int bufferSize, int maxRegionSize) Deprecated.Construct a new instance.ByteBufferSlicePool(BufferAllocator<ByteBuffer> allocator, int bufferSize, int maxRegionSize, int threadLocalQueueSize) Deprecated.Construct a new instance. -
Method Summary
Modifier and TypeMethodDescriptionallocate()Deprecated.Allocate a resource from the pool.voidclean()Deprecated.Cleans the pool, removing references to any buffers inside it.intDeprecated.Return the size of theByteBuffers that are returned byallocate().
-
Constructor Details
-
ByteBufferSlicePool
public ByteBufferSlicePool(BufferAllocator<ByteBuffer> allocator, int bufferSize, int maxRegionSize, int threadLocalQueueSize) Deprecated.Construct a new instance.- Parameters:
allocator- the buffer allocator to usebufferSize- the size of each buffermaxRegionSize- the maximum region size for each backing bufferthreadLocalQueueSize- the number of buffers to cache on each thread
-
ByteBufferSlicePool
public ByteBufferSlicePool(BufferAllocator<ByteBuffer> allocator, int bufferSize, int maxRegionSize) Deprecated.Construct a new instance.- Parameters:
allocator- the buffer allocator to usebufferSize- the size of each buffermaxRegionSize- the maximum region size for each backing buffer
-
ByteBufferSlicePool
public ByteBufferSlicePool(int bufferSize, int maxRegionSize) Deprecated.Construct a new instance, using a direct buffer allocator.- Parameters:
bufferSize- the size of each buffermaxRegionSize- the maximum region size for each backing buffer
-
-
Method Details
-
allocate
Deprecated.Allocate a resource from the pool.- Specified by:
allocatein interfacePool<ByteBuffer>- Returns:
- the resource
-
clean
public void clean()Deprecated.Cleans the pool, removing references to any buffers inside it. Should be invoked on pool disposal, when the pool will no longer be used. -
getBufferSize
public int getBufferSize()Deprecated.Return the size of theByteBuffers that are returned byallocate().
-
ByteBufferPool.