- java.lang.Object
-
- org.xnio.ByteBufferSlicePool
-
- All Implemented Interfaces:
Pool<java.nio.ByteBuffer>
public final class ByteBufferSlicePool extends java.lang.Object implements Pool<java.nio.ByteBuffer>
Deprecated.SeeByteBufferPool.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 invokeclean()to make sure that direct allocated buffers can be reused by a future instance.- Author:
- David M. Lloyd, Flavia Rainone
-
-
Constructor Summary
Constructors Constructor Description ByteBufferSlicePool(int bufferSize, int maxRegionSize)Deprecated.Construct a new instance, using a direct buffer allocator.ByteBufferSlicePool(BufferAllocator<java.nio.ByteBuffer> allocator, int bufferSize, int maxRegionSize)Deprecated.Construct a new instance.ByteBufferSlicePool(BufferAllocator<java.nio.ByteBuffer> allocator, int bufferSize, int maxRegionSize, int threadLocalQueueSize)Deprecated.Construct a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Pooled<java.nio.ByteBuffer>allocate()Deprecated.Allocate a resource from the pool.voidclean()Deprecated.Cleans the pool, removing references to any buffers inside it.intgetBufferSize()Deprecated.Return the size of theByteBuffers that are returned byallocate().
-
-
-
Constructor Detail
-
ByteBufferSlicePool
public ByteBufferSlicePool(BufferAllocator<java.nio.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<java.nio.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 Detail
-
allocate
public Pooled<java.nio.ByteBuffer> allocate()
Deprecated.Allocate a resource from the pool.
-
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().
-
-