Package com.mongodb.internal.connection
Class PowerOfTwoBufferPool
- java.lang.Object
-
- com.mongodb.internal.connection.PowerOfTwoBufferPool
-
- All Implemented Interfaces:
BufferProvider
public class PowerOfTwoBufferPool extends java.lang.Object implements BufferProvider
Power-of-two buffer pool implementation.This class should not be considered a part of the public API.
-
-
Constructor Summary
Constructors Constructor Description PowerOfTwoBufferPool()
Construct an instance with a highest power of two of 24.PowerOfTwoBufferPool(int highestPowerOfTwo)
Construct an instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ByteBuf
getBuffer(int size)
Gets a buffer with the givens capacity.
-
-
-
Constructor Detail
-
PowerOfTwoBufferPool
public PowerOfTwoBufferPool()
Construct an instance with a highest power of two of 24.
-
PowerOfTwoBufferPool
public PowerOfTwoBufferPool(int highestPowerOfTwo)
Construct an instance.- Parameters:
highestPowerOfTwo
- the highest power of two buffer size that will be pooled
-
-
Method Detail
-
getBuffer
public ByteBuf getBuffer(int size)
Description copied from interface:BufferProvider
Gets a buffer with the givens capacity.- Specified by:
getBuffer
in interfaceBufferProvider
- Parameters:
size
- the size required for the buffer- Returns:
- a ByteBuf with the given size, which is now owned by the caller and must be released.
-
-