Interface BufferPool

All Known Implementing Classes:
NoPool, RecyclingBufferPool

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

    Modifier and Type
    Method
    Description
    get(int capacity)
    Fetch a buffer from the pool.
    void
    Return a buffer to the pool.
  • Method Details

    • get

      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(ByteBuffer buffer)
      Return a buffer to the pool.
      Parameters:
      buffer - the buffer to return