Package org.jenkinsci.remoting.util
Class DirectByteBufferPool
- java.lang.Object
-
- org.jenkinsci.remoting.util.DirectByteBufferPool
-
- All Implemented Interfaces:
ByteBufferPool
public class DirectByteBufferPool extends Object implements ByteBufferPool
A buffer pool that keeps a free list ofByteBuffer
s of a specified default size in a simple fixed size stack. If the stack is full, the buffer is de-referenced and available to be freed by normal garbage collection (whenever that may actually take place)- See Also:
- JDK-4469299, More detail
-
-
Constructor Summary
Constructors Constructor Description DirectByteBufferPool(int minBufferSize, int maxPoolSize)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ByteBuffer
acquire(int size)
Borrow a buffer from the pool.void
release(ByteBuffer buffer)
Returns a buffer to the pool.
-
-
-
Method Detail
-
acquire
public ByteBuffer acquire(int size)
Borrow a buffer from the pool.- Specified by:
acquire
in interfaceByteBufferPool
- Parameters:
size
- The minimum size and initial limit of the buffer.- Returns:
- the buffer.
-
release
public void release(ByteBuffer buffer)
Returns a buffer to the pool.- Specified by:
release
in interfaceByteBufferPool
- Parameters:
buffer
- the buffer.
-
-