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.

Version:
$Rev: 1685 $, $Date: 2009-08-28 16:15:49 +0900 (금, 28 8 2009) $
Author:
The Netty Project (netty-dev@lists.jboss.org), Trustin Lee (tlee@redhat.com)

Method Summary
 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.
 

Method Detail

nextReceiveBufferSize

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.

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


Copyright © 2008-2009 JBoss, by Red Hat. All Rights Reserved.