Interface BufferPool

All Known Implementing Classes:
NoPool, RecyclingBufferPool

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

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

    • get

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