Project JXTA

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

java.lang.Object
  extended by net.jxta.impl.util.pipe.reliable.FlowControl
Direct Known Subclasses:
AdaptiveFlowControl, FixedFlowControl

public abstract class FlowControl
extends Object

A basis for any flow control module to be plugged into ReliableOutputStream. Synchronization can is assumed to be provided externaly. However all implementations are required to allow the getRwindow() method to be called at any time without synchronization.


Constructor Summary
FlowControl()
           
 
Method Summary
 void ackEventBegin()
          Indicates that a new ack message is being processed.
abstract  int ackEventEnd(int rQSize, long aveRTT, long lastRTT)
          Concludes rwindow update for this ackEvent.
abstract  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
 

Constructor Detail

FlowControl

public FlowControl()
Method Detail

getRwindow

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


ackEventBegin

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


packetACKed

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

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.

Parameters:
seqnum - The sequence number of the missing packet.

ackEventEnd

public abstract 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.

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.

JXTA J2SE