org.jgroups.stack

## Class AckSenderWindow

- java.lang.Object
- - org.jgroups.stack.AckSenderWindow

All Implemented Interfaces:
  Retransmitter.RetransmitCommand

    public class AckSenderWindow
    extends java.lang.Object
    implements 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
`static interface` `AckSenderWindow.RetransmitCommand`

### Constructor Summary

Constructors
Constructor and Description
`AckSenderWindow()` Creates an instance without retransmitter
`AckSenderWindow(AckSenderWindow.RetransmitCommand com)`
`AckSenderWindow(AckSenderWindow.RetransmitCommand com, Interval interval, TimeScheduler sched)`
`AckSenderWindow(AckSenderWindow.RetransmitCommand com, Interval interval, TimeScheduler sched, Address sender)`

### Method Summary

Methods
`void` `ack(long seqno)` Removes all messages less than or equal to seqno from `msgs`, and cancels their retransmission
`void` `add(long seqno, Message msg)` Adds a new message to the retransmission table.
`void` `addToMessages(long seqno, Message msg)`
`void` `addToRetransmitter(long seqno, Message msg)`
`Message` `get(long seqno)`
`long` `getHighest()`
`long` `getLowest()` Only to be used for testing purposes
`Message` `getLowestMessage()` Returns the message with the lowest seqno
`java.lang.String` `printDetails()`
`void` `reset()`
`void` `retransmit(long first_seqno, long last_seqno, Address sender)` Get the missing messages between sequence numbers `first_seqno` and `last_seqno`.
`int` `size()`
`java.lang.String` `toString()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### AckSenderWindow

    public AckSenderWindow(AckSenderWindow.RetransmitCommand com)

#### AckSenderWindow

    public AckSenderWindow(AckSenderWindow.RetransmitCommand com,
                   Interval interval,
                   TimeScheduler sched)

#### AckSenderWindow

    public AckSenderWindow(AckSenderWindow.RetransmitCommand com,
                   Interval interval,
                   TimeScheduler sched,
                   Address sender)

#### AckSenderWindow

    public AckSenderWindow()

Creates an instance without retransmitter

### Method Detail

#### getLowest

    public long getLowest()

Only to be used for testing purposes

#### getHighest

    public long getHighest()

#### reset

    public void reset()

#### get

    public Message get(long seqno)

#### add

    public void add(long seqno,
           Message msg)

Adds a new message to the retransmission table. The message will be retransmitted (based on timeouts passed into AckSenderWindow until (1) an ACK is received or (2) the AckSenderWindow is stopped (@link{#reset})

#### addToMessages

    public void addToMessages(long seqno,
                     Message msg)

#### addToRetransmitter

    public void addToRetransmitter(long seqno,
                          Message msg)

#### ack

    public void ack(long seqno)

Removes all messages less than or equal to seqno from `msgs`, and cancels their retransmission

#### getLowestMessage

    public Message getLowestMessage()

Returns the message with the lowest seqno

#### size

    public int size()

#### toString

    public java.lang.String toString()

Overrides:
  `toString` in class `java.lang.Object`

#### printDetails

    public java.lang.String printDetails()

#### retransmit

    public void retransmit(long first_seqno,
                  long last_seqno,
                  Address sender)

Description copied from interface: `Retransmitter.RetransmitCommand`
Get the missing messages between sequence numbers `first_seqno` and `last_seqno`. This can either be done by sending a retransmit message to destination `sender` (nak-based scheme), or by retransmitting the missing message(s) to `sender` (ack-based scheme).

Specified by:
  `retransmit` in interface `Retransmitter.RetransmitCommand`
Parameters:
  `first_seqno` - The sequence number of the first missing message
  `last_seqno` - The sequence number of the last missing message
  `sender` - 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).