Package org.jgroups.stack
Class AckSenderWindow
java.lang.Object
org.jgroups.stack.AckSenderWindow
- All Implemented Interfaces:
Retransmitter.RetransmitCommand
ACK-based sliding window for a sender. Messages are added to the window keyed by seqno
When an ACK is received, the corresponding message is removed. The Retransmitter
continously iterates over the entries in the hashmap, retransmitting messages based on their
creation time and an (increasing) timeout. When there are no more messages in the retransmission
table left, the thread terminates. It will be re-activated when a new entry is added to the
retransmission table.
- Author:
- Bela Ban
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance.AckSenderWindow
(AckSenderWindow.RetransmitCommand com, Interval interval) AckSenderWindow
(AckSenderWindow.RetransmitCommand com, Interval interval, TimeScheduler sched) AckSenderWindow
(AckSenderWindow.RetransmitCommand com, Interval interval, TimeScheduler sched, Address sender) -
Method Summary
Modifier and TypeMethodDescriptionvoid
ack
(long seqno) Removes all messages less than or equal to seqno frommsgs
, and cancels their retransmission.void
Adds a new message to the retransmission table.Returns the message with the lowest seqnostatic void
void
reset()
void
retransmit
(long first_seqno, long last_seqno, Address sender) Get the missing messages between sequence numbersfirst_seqno
andlast_seqno
.int
size()
toString()
-
Constructor Details
-
AckSenderWindow
Creates a new instance. Thre retransmission thread has to be started separately withstart()
.- Parameters:
com
- If not null, its methodretransmit()
will be called when a message needs to be retransmitted (called by the Retransmitter).
-
AckSenderWindow
-
AckSenderWindow
public AckSenderWindow(AckSenderWindow.RetransmitCommand com, Interval interval, TimeScheduler sched) -
AckSenderWindow
public AckSenderWindow(AckSenderWindow.RetransmitCommand com, Interval interval, TimeScheduler sched, Address sender)
-
-
Method Details
-
reset
public void reset() -
add
Adds a new message to the retransmission table. If the message won't have received an ack within a certain time frame, the retransmission thread will retransmit the message to the receiver. A message will be retransmitted until an ack for it is received, or the destination member is excluded from the group -
ack
public void ack(long seqno) Removes all messages less than or equal to seqno frommsgs
, and cancels their retransmission. -
getLowestMessage
Returns the message with the lowest seqno -
size
public int size() -
toString
-
printDetails
-
retransmit
Description copied from interface:Retransmitter.RetransmitCommand
Get the missing messages between sequence numbersfirst_seqno
andlast_seqno
. This can either be done by sending a retransmit message to destinationsender
(nak-based scheme), or by retransmitting the missing message(s) tosender
(ack-based scheme).- Specified by:
retransmit
in interfaceRetransmitter.RetransmitCommand
- Parameters:
first_seqno
- The sequence number of the first missing messagelast_seqno
- The sequence number of the last missing messagesender
- The destination of the member to which the retransmit request will be sent (nak-based scheme), or to which the message will be retransmitted (ack-based scheme).
-
getLowestSeqno
-
main
-