Class DefaultByteBufferPool

  • All Implemented Interfaces:
    ByteBufferPool, java.io.Closeable, java.lang.AutoCloseable

    public class DefaultByteBufferPool
    extends java.lang.Object
    implements ByteBufferPool
    A byte buffer pool that supports reference counted pools. TODO: move this somewhere more appropriate
    Author:
    Stuart Douglas
    • Constructor Detail

      • DefaultByteBufferPool

        public DefaultByteBufferPool​(boolean direct,
                                     int bufferSize)
        Parameters:
        direct - If this implementation should use direct buffers
        bufferSize - The buffer size to use
      • DefaultByteBufferPool

        public DefaultByteBufferPool​(boolean direct,
                                     int bufferSize,
                                     int maximumPoolSize,
                                     int threadLocalCacheSize,
                                     int leakDecetionPercent)
        Parameters:
        direct - If this implementation should use direct buffers
        bufferSize - The buffer size to use
        maximumPoolSize - The maximum pool size, in number of buffers, it does not include buffers in thread local caches
        threadLocalCacheSize - The maximum number of buffers that can be stored in a thread local cache
      • DefaultByteBufferPool

        public DefaultByteBufferPool​(boolean direct,
                                     int bufferSize,
                                     int maximumPoolSize,
                                     int threadLocalCacheSize)
        Parameters:
        direct - If this implementation should use direct buffers
        bufferSize - The buffer size to use
        maximumPoolSize - The maximum pool size, in number of buffers, it does not include buffers in thread local caches
        threadLocalCacheSize - The maximum number of buffers that can be stored in a thread local cache
    • Method Detail

      • getArrayBackedPool

        public ByteBufferPool getArrayBackedPool()
        Description copied from interface: ByteBufferPool
        If this byte buffer pool corresponds to an array backed pool then this will return itself. Otherwise it will return an array backed pool that contains buffers of the same size.
        Specified by:
        getArrayBackedPool in interface ByteBufferPool
        Returns:
        An array backed pool of the same size
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface ByteBufferPool
        Specified by:
        close in interface java.io.Closeable
      • finalize

        protected void finalize()
                         throws java.lang.Throwable
        Overrides:
        finalize in class java.lang.Object
        Throws:
        java.lang.Throwable