Interface BufferPool

  • All Known Implementing Classes:
    NoPool, RecyclingBufferPool

    public interface BufferPool
    An interface that allows users to customize how buffers are recycled.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.nio.ByteBuffer get​(int capacity)
      Fetch a buffer from the pool.
      void release​(java.nio.ByteBuffer buffer)
      Return a buffer to the pool.
    • Method Detail

      • get

        java.nio.ByteBuffer get​(int capacity)
        Fetch a buffer from the pool.
        Parameters:
        capacity - the desired size of the buffer
        Returns:
        a heap buffer with size at least the `capacity` and arrayOffset of 0
      • release

        void release​(java.nio.ByteBuffer buffer)
        Return a buffer to the pool.
        Parameters:
        buffer - the buffer to return