JXTA

net.jxta.impl.util.pipe.reliable
Class AdaptiveFlowControl

java.lang.Object
  extended by net.jxta.impl.util.pipe.reliable.FlowControl
      extended by net.jxta.impl.util.pipe.reliable.AdaptiveFlowControl

public class AdaptiveFlowControl
extends FlowControl


Field Summary
(package private) static int DEFAULT_RWINDOW
           
(package private)  boolean fastMode
           
(package private)  int takeAchance
           
 
Constructor Summary
AdaptiveFlowControl()
          Constructs an adaptive flow control module with an initial rwindow of DEFAULT_RWINDOW.
AdaptiveFlowControl(int rwindow)
           
 
Method Summary
 void ackEventBegin()
          Indicates that a new ack message is being processed.
 int ackEventEnd(int rQSize, long aveRTT, long lastRTT)
          Concludes rwindow update for this ackEvent.
 int getRwindow()
          Returns the rwindow size that this flow control module suggests to use at this point in time.
 void packetACKed(int seqnum)
          Invoked for each packet that is believed to have been received per the current ack message.
 void packetMissing(int seqnum)
          Invoked for each packet that is believed to have been lost per the current ack message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_RWINDOW

static final int DEFAULT_RWINDOW
See Also:
Constant Field Values

fastMode

boolean fastMode

takeAchance

int takeAchance
Constructor Detail

AdaptiveFlowControl

public AdaptiveFlowControl()
Constructs an adaptive flow control module with an initial rwindow of DEFAULT_RWINDOW.


AdaptiveFlowControl

public AdaptiveFlowControl(int rwindow)
Parameters:
rwindow - Use this value as the initial value (not recommended except for experimental purposes.
Method Detail

getRwindow

public int getRwindow()
Returns the rwindow size that this flow control module suggests to use at this point in time.

Specified by:
getRwindow in class FlowControl
Returns:
the remote window size

ackEventBegin

public void ackEventBegin()
Indicates that a new ack message is being processed.

Overrides:
ackEventBegin in class FlowControl

packetACKed

public void packetACKed(int seqnum)
Invoked for each packet that is believed to have been received per the current ack message.

Overrides:
packetACKed in class FlowControl
Parameters:
seqnum - The sequence number of the received packet.

packetMissing

public void packetMissing(int seqnum)
Invoked for each packet that is believed to have been lost per the current ack message.

Overrides:
packetMissing in class FlowControl
Parameters:
seqnum - The sequence number of the missing packet.

ackEventEnd

public int ackEventEnd(int rQSize,
                       long aveRTT,
                       long lastRTT)
Concludes rwindow update for this ackEvent. That's where all the smarts are. A number of externally computed parameters must be passed.

Specified by:
ackEventEnd in class FlowControl
Parameters:
rQSize - the last known value of the remote queue size.
aveRTT - the latest estimate of the average RTT.
lastRTT - the RTT inferred from the most recent ACK message.
Returns:
int the new recommended value for rwindow.

JXSE