Class AdaptiveReadHandleFactory

  • All Implemented Interfaces:
    ReadHandleFactory

    public class AdaptiveReadHandleFactory
    extends MaxMessagesReadHandleFactory
    The ReadHandleFactory 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.

    • Constructor Detail

      • AdaptiveReadHandleFactory

        public AdaptiveReadHandleFactory()
        Creates a new predictor with the default parameters. With the default parameters, the expected buffer size starts from 1024, does not go down below 64, and does not go up above 65536.
      • AdaptiveReadHandleFactory

        public AdaptiveReadHandleFactory​(int maxMessagesPerRead)
        Creates a new predictor with the default parameters. With the default parameters, the expected buffer size starts from 1024, does not go down below 64, and does not go up above 65536.
        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 size
        initial - the initial buffer size when no feedback was received
        maximum - the inclusive upper bound of the expected buffer size