Package org.jboss.netty.channel
Interface ReceiveBufferSizePredictor
- All Known Implementing Classes:
AdaptiveReceiveBufferSizePredictor
,FixedReceiveBufferSizePredictor
public interface ReceiveBufferSizePredictor
Predicts the number of readable bytes in the receive buffer of a
Channel
.
It calculates the close-to-optimal capacity of the ChannelBuffer
for the next read operation depending on the actual number of read bytes
in the previous read operation. More accurate the prediction is, more
effective the memory utilization will be.
Once a read operation is performed and the actual number of read bytes is
known, an I/O thread will call previousReceiveBufferSize(int)
to
update the predictor so it can predict more accurately next time.
-
Method Summary
Modifier and TypeMethodDescriptionint
Predicts the capacity of theChannelBuffer
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.
-
Method Details
-
nextReceiveBufferSize
int nextReceiveBufferSize()Predicts the capacity of theChannelBuffer
for the next read operation depending on the actual number of read bytes in the previous read operation.- Returns:
- the expected number of readable bytes this time
-
previousReceiveBufferSize
void previousReceiveBufferSize(int previousReceiveBufferSize) Updates this predictor by specifying the actual number of read bytes in the previous read operation.- Parameters:
previousReceiveBufferSize
- the actual number of read bytes in the previous read operation
-