Interface RetainableByteBufferPool

All Known Implementing Classes:
ArrayRetainableByteBufferPool

public interface RetainableByteBufferPool

A RetainableByteBuffer pool.

Acquired buffers must be released by calling RetainableByteBuffer.release() otherwise the memory they hold will be leaked.

  • Method Details

    • acquire

      RetainableByteBuffer acquire(int size, boolean direct)
      Acquires a memory buffer from the pool.
      Parameters:
      size - The size of the buffer. The returned buffer will have at least this capacity.
      direct - true if a direct memory buffer is needed, false otherwise.
      Returns:
      a memory buffer.
    • findOrAdapt

      static RetainableByteBufferPool findOrAdapt(org.eclipse.jetty.util.component.Container container, ByteBufferPool byteBufferPool)
      Finds a RetainableByteBufferPool implementation in the given container, or wrap the given ByteBufferPool with an adapter.
      Parameters:
      container - the container to search for an existing memory pool.
      byteBufferPool - the ByteBufferPool to wrap if no memory pool was found in the container.
      Returns:
      the RetainableByteBufferPool found or the wrapped one.