JXTA

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

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

public class FixedFlowControl
extends FlowControl


Field Summary
(package private) static int DEFAULT_RWINDOW
           
(package private)  int maxRwindow
           
(package private)  int rwindow
           
 
Constructor Summary
FixedFlowControl()
          Constructs a fixed flow control module with a fixed rwindow of DEFAULT_RWINDOW.
FixedFlowControl(int rwindow)
           
 
Method Summary
 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.
 
Methods inherited from class net.jxta.impl.util.pipe.reliable.FlowControl
ackEventBegin, packetACKed, packetMissing
 
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

maxRwindow

int maxRwindow

rwindow

int rwindow
Constructor Detail

FixedFlowControl

public FixedFlowControl()
Constructs a fixed flow control module with a fixed rwindow of DEFAULT_RWINDOW. It is not completely fixed. It grows by one at every ack message until it reaches the set RWINDOW.


FixedFlowControl

public FixedFlowControl(int rwindow)
Parameters:
rwindow - Use the specified value as the constant rwindow
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

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