Package org.eclipse.jetty.io
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 Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description RetainableByteBuffer
acquire(int size, boolean direct)
Acquires a memory buffer from the pool.static RetainableByteBufferPool
findOrAdapt(Container container, ByteBufferPool byteBufferPool)
Finds aRetainableByteBufferPool
implementation in the given container, or wrap the givenByteBufferPool
with an adapter.
-
-
-
Method Detail
-
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(Container container, ByteBufferPool byteBufferPool)
Finds aRetainableByteBufferPool
implementation in the given container, or wrap the givenByteBufferPool
with an adapter.- Parameters:
container
- the container to search for an existing memory pool.byteBufferPool
- theByteBufferPool
to wrap if no memory pool was found in the container.- Returns:
- the
RetainableByteBufferPool
found or the wrapped one.
-
-