Package io.netty.channel.uring
Class IoUringAdaptiveBufferRingAllocator
- java.lang.Object
-
- io.netty.channel.uring.IoUringAdaptiveBufferRingAllocator
-
- All Implemented Interfaces:
IoUringBufferRingAllocator
public final class IoUringAdaptiveBufferRingAllocator extends java.lang.Object implements IoUringBufferRingAllocator
IoUringBufferRingAllocator
implementation which uses an adaptive strategy to allocate buffers, which will decrease / increase the buffer size depending on if the allocated buffers were completely used or not before.
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_INITIAL
static int
DEFAULT_MAXIMUM
static int
DEFAULT_MINIMUM
-
Constructor Summary
Constructors Constructor Description IoUringAdaptiveBufferRingAllocator()
IoUringAdaptiveBufferRingAllocator(ByteBufAllocator allocator)
Creates new instance.IoUringAdaptiveBufferRingAllocator(ByteBufAllocator allocator, int minimum, int initial, int maximum)
Creates new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ByteBuf
allocate()
Creates a new receive buffer to use by the buffer ring.void
lastBytesRead(int attempted, int actual)
Set the bytes that have been read for the last read operation that was full-filled out of the buffer ring.
-
-
-
Field Detail
-
DEFAULT_MINIMUM
public static final int DEFAULT_MINIMUM
- See Also:
- Constant Field Values
-
DEFAULT_INITIAL
public static final int DEFAULT_INITIAL
- See Also:
- Constant Field Values
-
DEFAULT_MAXIMUM
public static final int DEFAULT_MAXIMUM
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
IoUringAdaptiveBufferRingAllocator
public IoUringAdaptiveBufferRingAllocator()
-
IoUringAdaptiveBufferRingAllocator
public IoUringAdaptiveBufferRingAllocator(ByteBufAllocator allocator)
Creates new instance.- Parameters:
allocator
- theByteBufAllocator
to use.
-
IoUringAdaptiveBufferRingAllocator
public IoUringAdaptiveBufferRingAllocator(ByteBufAllocator allocator, int minimum, int initial, int maximum)
Creates new instance.- Parameters:
allocator
- theByteBufAllocator
to use for the allocationsminimum
- the inclusive lower bound of the expected buffer sizeinitial
- the initial buffer size when no feed back was receivedmaximum
- the inclusive upper bound of the expected buffer size
-
-
Method Detail
-
allocate
public ByteBuf allocate()
Description copied from interface:IoUringBufferRingAllocator
Creates a new receive buffer to use by the buffer ring. The returnedByteBuf
must be direct.- Specified by:
allocate
in interfaceIoUringBufferRingAllocator
-
lastBytesRead
public void lastBytesRead(int attempted, int actual)
Description copied from interface:IoUringBufferRingAllocator
Set the bytes that have been read for the last read operation that was full-filled out of the buffer ring.- Specified by:
lastBytesRead
in interfaceIoUringBufferRingAllocator
- Parameters:
attempted
- the attempted bytes to read.actual
- the number of bytes that could be read.
-
-