All Packages Class Hierarchy This Package Previous Next Index
Class JavaGroups.AckMcastSenderWindow
java.lang.Object
|
+----JavaGroups.AckMcastSenderWindow
- public class AckMcastSenderWindow
- extends Object
- implements Runnable
Keeps track of ACKs from receivers for each message. When a new message is sent, it is tagged with
a sequence number and the receiver set (set of members to which the message is sent) and added
to a hashtable (key = sequence number, val = message + receiver set). Each incoming ACK is noted
and when all ACKs for a specific sequence number haven been received, the corresponding entry is
removed from the hashtable. A retransmission thread periodically re-sends the message point-to-point
to all receivers from which no ACKs have been received yet. A view change or suspect message causes
the corresponding non-existing receivers to be removed from the hashtable.
This class may need flow control in order to avoid needless retransmissions because of
timeouts.
- Author:
- Bela Ban June 9 1999
-
AckMcastSenderWindow(AckMcastSenderWindow. RetransmitCommand)
-
-
Ack(long, Object)
- An ACK has been received from
sender
.
-
Add(long, Message, Vector)
- Adds a new message to the hash table.
-
GetStableMessages()
- Returns copy of stable messages, or null (if non available).
-
main(String[])
-
-
Remove(Object)
- Remove
obj
from all receiver sets and wake up retransmission thread.
-
Reset()
- Remove all entries from the hashtable.
-
run()
- Retransmitter thread.
-
Size()
-
-
Start()
-
-
Stop()
-
-
Suspect(Object)
- Process with address
suspected
is suspected: remove it from all receiver sets.
-
toString()
-
-
WaitUntilAllAcksReceived(long)
- Waits until all outstanding messages have been ACKed by all receivers.
AckMcastSenderWindow
public AckMcastSenderWindow(AckMcastSenderWindow. RetransmitCommand command)
GetStableMessages
public Vector GetStableMessages()
- Returns copy of stable messages, or null (if non available). Removes all stable messages
afterwards
Size
public long Size()
Add
public void Add(long seqno,
Message msg,
Vector receivers)
- Adds a new message to the hash table.
- Parameters:
- seqno - The sequence number associated with the message
- msg - The message (should be a copy !)
- receivers - The set of addresses to which the message was sent and from which
consequently an ACK is expected
Ack
public void Ack(long seqno,
Object sender)
- An ACK has been received from
sender
. Tag the sender in the hash table as
'received'. If all ACKs have been received, remove the entry altogether.
- Parameters:
- seqno - The sequence number of the message for which an ACK has been received.
- sender - The sender which sent the ACK
Remove
public void Remove(Object obj)
- Remove
obj
from all receiver sets and wake up retransmission thread.
Suspect
public void Suspect(Object suspected)
- Process with address
suspected
is suspected: remove it from all receiver sets.
This means that no ACKs are expected from this process anymore.
- Parameters:
- suspected - The suspected process
Reset
public void Reset()
- Remove all entries from the hashtable. Stop the retransmitter thread
WaitUntilAllAcksReceived
public void WaitUntilAllAcksReceived(long timeout)
- Waits until all outstanding messages have been ACKed by all receivers. Takes into account
suspicions and view changes. Returns when there are no entries left in the hashtable.
While waiting, no entries can be added to the hashtable (they will be discarded).
- Parameters:
- timeout - Miliseconds to wait. 0 means wait indefinitely.
run
public void run()
- Retransmitter thread. While there are messages available for which not all ACKs have been
received yet, retransmit those without ACKs.
toString
public String toString()
- Overrides:
- toString in class Object
Start
public synchronized void Start()
Stop
public synchronized void Stop()
main
public static void main(String args[])
All Packages Class Hierarchy This Package Previous Next Index