- java.lang.Object
-
- io.netty5.channel.DefaultMaxMessagesRecvBufferAllocator
-
- io.netty5.channel.AdaptiveRecvBufferAllocator
-
- All Implemented Interfaces:
MaxMessagesRecvBufferAllocator
,RecvBufferAllocator
public class AdaptiveRecvBufferAllocator extends DefaultMaxMessagesRecvBufferAllocator
TheRecvBufferAllocator
that automatically increases and decreases the predicted buffer size on feed back.It gradually increases the expected number of readable bytes if the previous read fully filled the allocated buffer. It gradually decreases the expected number of readable bytes if the read operation was unable to fill a certain amount of the allocated buffer two times consecutively. Otherwise, it keeps returning the same prediction.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class io.netty5.channel.DefaultMaxMessagesRecvBufferAllocator
DefaultMaxMessagesRecvBufferAllocator.MaxMessageHandle
-
Nested classes/interfaces inherited from interface io.netty5.channel.RecvBufferAllocator
RecvBufferAllocator.Handle
-
-
Field Summary
Fields Modifier and Type Field Description static AdaptiveRecvBufferAllocator
DEFAULT
Deprecated.There is state forDefaultMaxMessagesRecvBufferAllocator.maxMessagesPerRead()
which is typically based upon channel type.
-
Constructor Summary
Constructors Constructor Description AdaptiveRecvBufferAllocator()
Creates a new predictor with the default parameters.AdaptiveRecvBufferAllocator(int minimum, int initial, int maximum)
Creates a new predictor with the specified parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description RecvBufferAllocator.Handle
newHandle()
Creates a new handle.-
Methods inherited from class io.netty5.channel.DefaultMaxMessagesRecvBufferAllocator
maxMessagesPerRead, maxMessagesPerRead
-
-
-
-
Field Detail
-
DEFAULT
@Deprecated public static final AdaptiveRecvBufferAllocator DEFAULT
Deprecated.There is state forDefaultMaxMessagesRecvBufferAllocator.maxMessagesPerRead()
which is typically based upon channel type.
-
-
Constructor Detail
-
AdaptiveRecvBufferAllocator
public AdaptiveRecvBufferAllocator()
Creates a new predictor with the default parameters. With the default parameters, the expected buffer size starts from1024
, does not go down below64
, and does not go up above65536
.
-
AdaptiveRecvBufferAllocator
public AdaptiveRecvBufferAllocator(int minimum, int initial, int maximum)
Creates a new predictor with the specified parameters.- Parameters:
minimum
- the inclusive lower bound of the expected buffer sizeinitial
- the initial buffer size when no feedback was receivedmaximum
- the inclusive upper bound of the expected buffer size
-
-
Method Detail
-
newHandle
public RecvBufferAllocator.Handle newHandle()
Description copied from interface:RecvBufferAllocator
Creates a new handle. The handle provides the actual operations and keeps the internal information which is required for predicting an optimal buffer capacity.
-
-