Module 
Package org.xnio

Class ByteBufferSlicePool

  • All Implemented Interfaces:
    Pool<java.nio.ByteBuffer>

    public final class ByteBufferSlicePool
    extends java.lang.Object
    implements Pool<java.nio.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.
    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 caches
      int getBufferSize()
      Deprecated.
      Return the size of the ByteBuffers that are returned by allocate().
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 use
        bufferSize - the size of each buffer
        maxRegionSize - the maximum region size for each backing buffer
        threadLocalQueueSize - 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 use
        bufferSize - the size of each buffer
        maxRegionSize - 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 buffer
        maxRegionSize - the maximum region size for each backing buffer
    • Method Detail

      • allocate

        public Pooled<java.nio.ByteBuffer> allocate()
        Deprecated.
        Allocate a resource from the pool.
        Specified by:
        allocate in interface Pool<java.nio.ByteBuffer>
        Returns:
        the resource
      • clean

        public void clean()
        Deprecated.
        Cleans all ThreadLocal caches
      • getBufferSize

        public int getBufferSize()
        Deprecated.
        Return the size of the ByteBuffers that are returned by allocate().