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
-
NakReceiverWindow(Object, NakReceiverWindow. RetransmitCommand, long)
-
-
Add(long, Message)
- Adds a message according to its sequence number (ordered).
-
finalize()
-
-
GetHighestDelivered()
- Returns the highest sequence number of a message consumed by the application (by Remove())
-
GetHighestReceived()
- Returns the highest sequence number received so far (which may be higher than the highest seqno
delivered so far
-
GetMessagesHigherThan(long)
- Return messages that are higher than
seqno
(excluding seqno
)
-
GetMessagesInRange(long, long)
-
Return all messages m for which the following holds: m > lower && m <= upper (excluding lower,
including upper).
-
main(String[])
-
-
Remove()
- Find the entry with seqno
head
.
-
Reset()
- Deletes all entries
-
SetRetransmitPeriod(long)
-
-
Size()
-
-
Stable(long)
- Delete all messages <= seqno (they are stable, that is, have been received at all members).
-
toString()
-
NakReceiverWindow
public NakReceiverWindow(Object sender,
NakReceiverWindow. RetransmitCommand command,
long start_seqno)
finalize
public void finalize()
- Overrides:
- finalize in class Object
SetRetransmitPeriod
public void SetRetransmitPeriod(long t)
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).
Remove
public Message Remove()
- Find the entry with seqno
head
. If e.msg is != null -> return it and increment
head
, else return null.
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).
Reset
public void Reset()
- Deletes all entries
GetHighestDelivered
public long GetHighestDelivered()
- Returns the highest sequence number of a message consumed by the application (by Remove())
GetHighestReceived
public long GetHighestReceived()
- Returns the highest sequence number received so far (which may be higher than the highest seqno
delivered so far
GetMessagesHigherThan
public List GetMessagesHigherThan(long seqno)
- Return messages that are higher than
seqno
(excluding seqno
)
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
.
Size
public int Size()
toString
public String toString()
- Overrides:
- toString in class Object
main
public static void main(String args[])
All Packages Class Hierarchy This Package Previous Next Index