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. A retransmission thread continously iterates over the entries,
retransmitting messages for which no ACK has been received in timeout
time.
-
AckSenderWindow(AckSenderWindow. RetransmitCommand, long)
- Creates a new instance.
-
Ack(long)
- Marks one message as received.
-
Add(long, Message)
-
Add a new message.
-
GetNextSeqno()
-
-
GetTimeout()
-
-
main(String[])
-
-
Reset()
-
-
run()
- Iterate over msgs.
-
SetTimeout(long)
-
-
Start()
- Starts the retransmission thread (will not be started automatically !).
-
Stop()
-
-
toString()
-
AckSenderWindow
public AckSenderWindow(AckSenderWindow. RetransmitCommand com,
long initial_seqno)
- 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).
- initial_seqno - The first sequence number to expect an ACK for.
GetNextSeqno
public long GetNextSeqno()
GetTimeout
public long GetTimeout()
SetTimeout
public void SetTimeout(long timeout)
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.
Stop
public void Stop()
Reset
public void Reset()
Add
public void Add(long seqno,
Message msg)
- Add a new message.
seqno
should always be 1 higher than the previous
one. Messages will be ordered according to seqno. Note that msg
must be a copy of
the message, otherwise the entry stored in this table might be modified by the message traveling
down the stack (e.g. addition of headers) !
Ack
public void Ack(long seqno)
- Marks one message as received. Removes as many messages as possible (removing them also from
retransmission), sets
next_seqno
correspondingly.
run
public void run()
- Iterate over msgs. For entries that haven't received an ACK within
timeout
time, issue a retransmission command.
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