- 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 Summary
Modifier and TypeMethodDescriptionacquire(int size, boolean direct) Acquires a memory buffer from the pool.static RetainableByteBufferPoolfindOrAdapt(org.eclipse.jetty.util.component.Container container, ByteBufferPool byteBufferPool) Finds aRetainableByteBufferPoolimplementation in the given container, or wrap the givenByteBufferPoolwith an adapter.
-
Method Details
-
acquire
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 aRetainableByteBufferPoolimplementation in the given container, or wrap the givenByteBufferPoolwith an adapter.- Parameters:
container- the container to search for an existing memory pool.byteBufferPool- theByteBufferPoolto wrap if no memory pool was found in the container.- Returns:
- the
RetainableByteBufferPoolfound or the wrapped one.
-