- java.lang.Object
-
- io.netty5.channel.MaxMessagesReadHandleFactory
-
- io.netty5.channel.AdaptiveReadHandleFactory
-
- All Implemented Interfaces:
ReadHandleFactory
public class AdaptiveReadHandleFactory extends MaxMessagesReadHandleFactory
TheReadHandleFactorythat 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.MaxMessagesReadHandleFactory
MaxMessagesReadHandleFactory.MaxMessageReadHandle
-
Nested classes/interfaces inherited from interface io.netty5.channel.ReadHandleFactory
ReadHandleFactory.ReadHandle
-
-
Constructor Summary
Constructors Constructor Description AdaptiveReadHandleFactory()Creates a new predictor with the default parameters.AdaptiveReadHandleFactory(int maxMessagesPerRead)Creates a new predictor with the default parameters.AdaptiveReadHandleFactory(int maxMessagesPerRead, 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 MaxMessagesReadHandleFactory.MaxMessageReadHandlenewMaxMessageHandle(int maxMessagesPerRead)Creates a newMaxMessagesReadHandleFactory.MaxMessageReadHandleto use.-
Methods inherited from class io.netty5.channel.MaxMessagesReadHandleFactory
newHandle
-
-
-
-
Constructor Detail
-
AdaptiveReadHandleFactory
public AdaptiveReadHandleFactory()
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.
-
AdaptiveReadHandleFactory
public AdaptiveReadHandleFactory(int maxMessagesPerRead)
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.- Parameters:
maxMessagesPerRead- the maximum number of messages to read per read loop invocation.
-
AdaptiveReadHandleFactory
public AdaptiveReadHandleFactory(int maxMessagesPerRead, int minimum, int initial, int maximum)Creates a new predictor with the specified parameters.- Parameters:
maxMessagesPerRead- the maximum number of messages to read per read loop invocation.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
-
newMaxMessageHandle
public MaxMessagesReadHandleFactory.MaxMessageReadHandle newMaxMessageHandle(int maxMessagesPerRead)
Description copied from class:MaxMessagesReadHandleFactoryCreates a newMaxMessagesReadHandleFactory.MaxMessageReadHandleto use.- Specified by:
newMaxMessageHandlein classMaxMessagesReadHandleFactory- Parameters:
maxMessagesPerRead- the maximum number of messages to read per read loop.- Returns:
- the handle.
-
-