Class QuiescentBufferPool

  • All Implemented Interfaces:
    BufferPool

    public final class QuiescentBufferPool
    extends java.lang.Object
    implements BufferPool
    A BufferPool implementation which does no pooling. New instances will be created for each call to allocate.
    • Constructor Detail

      • QuiescentBufferPool

        private QuiescentBufferPool()
    • Method Detail

      • getInstance

        public static BufferPool getInstance()
        Returns:
        Instance of BufferPool which does no caching/reuse of instances.
      • allocateArray

        public byte[] allocateArray​(int size)
        Creates a new byte[] of size.
        Specified by:
        allocateArray in interface BufferPool
        Parameters:
        size - The minimum size array required. Must be >= 0.
        Returns:
        A byte[] with length of at least size.
        See Also:
        BufferPool.releaseArray(byte[])
      • releaseArray

        public void releaseArray​(byte[] buffer)
        Does nothing.
        Specified by:
        releaseArray in interface BufferPool
        Parameters:
        buffer - Instance to return to pool. Must not be null. Must not be returned more than 1 time. Must not be used by caller after return.
      • allocateDirect

        public java.nio.ByteBuffer allocateDirect​(int size)
        Allocates a direct ByteBuffer of size.
        Specified by:
        allocateDirect in interface BufferPool
        Parameters:
        size - The minimum size buffer required. Must be >= 0.
        Returns:
        A ByteBuffer of size or greater capacity.
        See Also:
        BufferPool.releaseDirect(ByteBuffer), ByteBuffer.allocateDirect(int)
      • releaseDirect

        public void releaseDirect​(java.nio.ByteBuffer buffer)
        Aggressively releases native resources associated with buffer.
        Specified by:
        releaseDirect in interface BufferPool
        Parameters:
        buffer - Instance to return to pool. Must not be null. Must not be returned more than 1 time. Must not be used by caller after return.