Package io.netty.channel
Class DefaultMaxBytesRecvByteBufAllocator
- java.lang.Object
-
- io.netty.channel.DefaultMaxBytesRecvByteBufAllocator
-
- All Implemented Interfaces:
MaxBytesRecvByteBufAllocator
,RecvByteBufAllocator
public class DefaultMaxBytesRecvByteBufAllocator extends java.lang.Object implements MaxBytesRecvByteBufAllocator
TheRecvByteBufAllocator
that yields a buffer size prediction based upon decrementing the value from the max bytes per read.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.netty.channel.RecvByteBufAllocator
RecvByteBufAllocator.DelegatingHandle, RecvByteBufAllocator.ExtendedHandle, RecvByteBufAllocator.Handle
-
-
Constructor Summary
Constructors Constructor Description DefaultMaxBytesRecvByteBufAllocator()
DefaultMaxBytesRecvByteBufAllocator(int maxBytesPerRead, int maxBytesPerIndividualRead)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
maxBytesPerIndividualRead()
Returns the maximum number of bytes to read per individual read operation.DefaultMaxBytesRecvByteBufAllocator
maxBytesPerIndividualRead(int maxBytesPerIndividualRead)
Sets the maximum number of bytes to read per individual read operation.int
maxBytesPerRead()
Returns the maximum number of bytes to read per read loop.DefaultMaxBytesRecvByteBufAllocator
maxBytesPerRead(int maxBytesPerRead)
Sets the maximum number of bytes to read per read loop.java.util.Map.Entry<java.lang.Integer,java.lang.Integer>
maxBytesPerReadPair()
Atomic way to get the maximum number of bytes to read for a read loop and per individual read operation.DefaultMaxBytesRecvByteBufAllocator
maxBytesPerReadPair(int maxBytesPerRead, int maxBytesPerIndividualRead)
Sets the maximum number of bytes to read for a read loop and per individual read operation.RecvByteBufAllocator.Handle
newHandle()
Creates a new handle.
-
-
-
Method Detail
-
newHandle
public RecvByteBufAllocator.Handle newHandle()
Description copied from interface:RecvByteBufAllocator
Creates a new handle. The handle provides the actual operations and keeps the internal information which is required for predicting an optimal buffer capacity.- Specified by:
newHandle
in interfaceRecvByteBufAllocator
-
maxBytesPerRead
public int maxBytesPerRead()
Description copied from interface:MaxBytesRecvByteBufAllocator
Returns the maximum number of bytes to read per read loop. achannelRead()
event. If this value is greater than 1, an event loop might attempt to read multiple times to procure bytes.- Specified by:
maxBytesPerRead
in interfaceMaxBytesRecvByteBufAllocator
-
maxBytesPerRead
public DefaultMaxBytesRecvByteBufAllocator maxBytesPerRead(int maxBytesPerRead)
Description copied from interface:MaxBytesRecvByteBufAllocator
Sets the maximum number of bytes to read per read loop. If this value is greater than 1, an event loop might attempt to read multiple times to procure bytes.- Specified by:
maxBytesPerRead
in interfaceMaxBytesRecvByteBufAllocator
-
maxBytesPerIndividualRead
public int maxBytesPerIndividualRead()
Description copied from interface:MaxBytesRecvByteBufAllocator
Returns the maximum number of bytes to read per individual read operation. achannelRead()
event. If this value is greater than 1, an event loop might attempt to read multiple times to procure bytes.- Specified by:
maxBytesPerIndividualRead
in interfaceMaxBytesRecvByteBufAllocator
-
maxBytesPerIndividualRead
public DefaultMaxBytesRecvByteBufAllocator maxBytesPerIndividualRead(int maxBytesPerIndividualRead)
Description copied from interface:MaxBytesRecvByteBufAllocator
Sets the maximum number of bytes to read per individual read operation. If this value is greater than 1, an event loop might attempt to read multiple times to procure bytes.- Specified by:
maxBytesPerIndividualRead
in interfaceMaxBytesRecvByteBufAllocator
-
maxBytesPerReadPair
public java.util.Map.Entry<java.lang.Integer,java.lang.Integer> maxBytesPerReadPair()
Description copied from interface:MaxBytesRecvByteBufAllocator
Atomic way to get the maximum number of bytes to read for a read loop and per individual read operation. If this value is greater than 1, an event loop might attempt to read multiple times to procure bytes.- Specified by:
maxBytesPerReadPair
in interfaceMaxBytesRecvByteBufAllocator
- Returns:
- The Key is from
MaxBytesRecvByteBufAllocator.maxBytesPerRead()
. The Value is fromMaxBytesRecvByteBufAllocator.maxBytesPerIndividualRead()
-
maxBytesPerReadPair
public DefaultMaxBytesRecvByteBufAllocator maxBytesPerReadPair(int maxBytesPerRead, int maxBytesPerIndividualRead)
Description copied from interface:MaxBytesRecvByteBufAllocator
Sets the maximum number of bytes to read for a read loop and per individual read operation. If this value is greater than 1, an event loop might attempt to read multiple times to procure bytes.- Specified by:
maxBytesPerReadPair
in interfaceMaxBytesRecvByteBufAllocator
- Parameters:
maxBytesPerRead
- seeMaxBytesRecvByteBufAllocator.maxBytesPerRead(int)
maxBytesPerIndividualRead
- seeMaxBytesRecvByteBufAllocator.maxBytesPerIndividualRead(int)
-
-