public class AdaptiveReceiveBufferSizePredictor extends java.lang.Object implements ReceiveBufferSizePredictor
ReceiveBufferSizePredictor 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 not able to fill a certain amount of the allocated buffer two times consecutively. Otherwise, it keeps returning the same prediction.
| 构造器和说明 |
|---|
AdaptiveReceiveBufferSizePredictor()
Creates a new predictor with the default parameters.
|
AdaptiveReceiveBufferSizePredictor(int minimum,
int initial,
int maximum)
Creates a new predictor with the specified parameters.
|
| 限定符和类型 | 方法和说明 |
|---|---|
int |
nextReceiveBufferSize()
Predicts the capacity of the
ChannelBuffer for the next
read operation depending on the actual number of read bytes in the
previous read operation. |
void |
previousReceiveBufferSize(int previousReceiveBufferSize)
Updates this predictor by specifying the actual number of read bytes
in the previous read operation.
|
public AdaptiveReceiveBufferSizePredictor()
1024, does not
go down below 64, and does not go up above 65536.public AdaptiveReceiveBufferSizePredictor(int minimum,
int initial,
int maximum)
minimum - 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 sizepublic int nextReceiveBufferSize()
ReceiveBufferSizePredictorChannelBuffer for the next
read operation depending on the actual number of read bytes in the
previous read operation.nextReceiveBufferSize 在接口中 ReceiveBufferSizePredictorpublic void previousReceiveBufferSize(int previousReceiveBufferSize)
ReceiveBufferSizePredictorpreviousReceiveBufferSize 在接口中 ReceiveBufferSizePredictorpreviousReceiveBufferSize - the actual number of read bytes in the previous read operation