All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class JavaGroups.NakReceiverWindow

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

public class NakReceiverWindow
extends Object
Keeps track of messages according to their sequence numbers. Allows messages to be added out of order, and with gaps between sequence numbers. Method Remove removes the first message with a sequence number that is 1 higher than next_to_remove (this variable is then incremented), or it returns null if no message is present, or if no message's sequence number is 1 higher.

Started out as a copy of SlidingWindow. Main diff: RetransmitCommand is different, and retransmission thread is only created upon detection of a gap.

Author:
Bela Ban May 27 1999

Constructor Index

 o NakReceiverWindow(Object, NakReceiverWindow. RetransmitCommand, long)

Method Index

 o Add(long, Message)
Adds a message according to its sequence number (ordered).
 o finalize()
 o GetHighestDelivered()
Returns the highest sequence number of a message consumed by the application (by Remove())
 o GetHighestReceived()
Returns the highest sequence number received so far (which may be higher than the highest seqno delivered so far
 o GetMessagesHigherThan(long)
Return messages that are higher than seqno (excluding seqno)
 o GetMessagesInRange(long, long)
Return all messages m for which the following holds: m > lower && m <= upper (excluding lower, including upper).
 o main(String[])
 o Remove()
Find the entry with seqno head.
 o Reset()
Deletes all entries
 o SetRetransmitPeriod(long)
 o Size()
 o Stable(long)
Delete all messages <= seqno (they are stable, that is, have been received at all members).
 o toString()

Constructors

 o NakReceiverWindow
 public NakReceiverWindow(Object sender,
                          NakReceiverWindow. RetransmitCommand command,
                          long start_seqno)

Methods

 o finalize
 public void finalize()
Overrides:
finalize in class Object
 o SetRetransmitPeriod
 public void SetRetransmitPeriod(long t)
 o Add
 public void Add(long seqno,
                 Message msg)
Adds a message according to its sequence number (ordered). Variables head and tail mark the start and end of the messages received, but not delivered yet. When a message is received, if its seqno is smaller than head, it is discarded (already received). If it is bigger than tail, we advance tail and add empty elements. If it is between head and tail, we set the corresponding missing (or already present) element. If it is equal to tail, we advance the latter by 1 and add the message (default case).

 o Remove
 public Message Remove()
Find the entry with seqno head. If e.msg is != null -> return it and increment head, else return null.

 o Stable
 public void Stable(long seqno)
Delete all messages <= seqno (they are stable, that is, have been received at all members). Stop when a number > seqno is encountered (all messages are ordered on seqnos).

 o Reset
 public void Reset()
Deletes all entries

 o GetHighestDelivered
 public long GetHighestDelivered()
Returns the highest sequence number of a message consumed by the application (by Remove())

 o GetHighestReceived
 public long GetHighestReceived()
Returns the highest sequence number received so far (which may be higher than the highest seqno delivered so far

 o GetMessagesHigherThan
 public List GetMessagesHigherThan(long seqno)
Return messages that are higher than seqno (excluding seqno)

 o GetMessagesInRange
 public List GetMessagesInRange(long lower,
                                long upper)
Return all messages m for which the following holds: m > lower && m <= upper (excluding lower, including upper). Check both msgs and delivered_msgs.

 o Size
 public int Size()
 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