All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class JavaGroups.AckSenderWindow

java.lang.Object
   |
   +----JavaGroups.AckSenderWindow

public class AckSenderWindow
extends Object
implements Runnable
ACK-based sliding window for a sender. Messages are added to the window according to message IDs. When an ACK is received, the corresponding entry is marked and the window advanced as much as possible. The addition of a message to a full window will block until a slot becomes free (when receiving an ACK). A retransmission thread continously iterates over the entries, retransmitting messages for which no ACK has been received in timeout time.


Constructor Index

 o AckSenderWindow(AckSenderWindow. RetransmitCommand, long)
Creates a new instance.
 o AckSenderWindow(int, AckSenderWindow. RetransmitCommand, long)
Creates a new instance.

Method Index

 o Ack(long)
Marks one message as received.
 o Add(long, Message)
Add a new message.
 o GetLowMark()
 o GetTimeout()
 o main(String[])
 o run()
Iterate over msgs.
 o SetTimeout(long)
 o Start()
Starts the retransmission thread (will not be started automatically !).
 o Stop()
 o toString()

Constructors

 o AckSenderWindow
 public AckSenderWindow(AckSenderWindow. RetransmitCommand com,
                        long low_mark)
Creates a new instance. Thre retransmission thread has to be started separately with Start.

Parameters:
com - If not null, its method Retransmit will be called when a message needs to be retransmitted (called by the retransmitter thread).
low_mark - The next sequence number to expect ACKs for.
 o AckSenderWindow
 public AckSenderWindow(int window_size,
                        AckSenderWindow. RetransmitCommand com,
                        long low_mark)
Creates a new instance. Thre retransmission thread has to be started separately with Start.

Parameters:
window_size - Determines how many messages can be added to the window before it blocks. The caller will be unblocked when a message is removed.
com - If not null, its method Retransmit will be called when a message needs to be retransmitted (called by the retransmitter thread).
low_mark - The next sequence number to expect ACKs for.

Methods

 o GetLowMark
 public long GetLowMark()
 o GetTimeout
 public long GetTimeout()
 o SetTimeout
 public void SetTimeout(long timeout)
 o Start
 public void Start()
Starts the retransmission thread (will not be started automatically !). The thread scans over the messages sent and requests retransmission for those that haven't received an ACK for a certain period of time.

 o Stop
 public void Stop()
 o Add
 public void Add(long seq_no,
                 Message msg)
Add a new message. seq_no should always be 1 higher than the previous one. Messages will be ordered according to seq_no. When the number of entries exceeds the maximum window size, the caller will be blocked until an ACK has been received (removing 1 message).

 o Ack
 public void Ack(long seq_no)
Marks one message as received. Removes as many messages as possible, sets low_mark correspondingly.

 o run
 public void run()
Iterate over msgs. For entries that haven't received an ACK within timeout time, issue a retransmission command.

 o toString
 public String toString()
Overrides:
toString in class Object
 o main
 public static void main(String args[])

All Packages  Class Hierarchy  This Package  Previous  Next  Index