- 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.- Author:
- David M. Lloyd
-
-
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.void
clean()
Deprecated.Cleans all ThreadLocal cachesint
getBufferSize()
Deprecated.Return the size of theByteBuffer
s 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 all ThreadLocal caches
-
getBufferSize
public int getBufferSize()
Deprecated.Return the size of theByteBuffer
s that are returned byallocate()
.
-
-