org.jgroups.stack

## Class RangeBasedRetransmitter

- java.lang.Object
- - org.jgroups.stack.Retransmitter
  - - org.jgroups.stack.RangeBasedRetransmitter

-     public class RangeBasedRetransmitter
      extends Retransmitter

  This retransmitter is specialized in maintaining ranges of seqnos, e.g. [3-20, [89-89], [100-120]. The ranges are stored in a sorted hashmap and the `Comparable.compareTo(Object)` method compares both ranges again ranges, and ranges against seqnos. The latter helps to find a range given a seqno, e.g. seqno 105 will find range [100-120].

  Each range is implemented by `SeqnoRange`, which has a bitset of all missing seqnos. When a seqno is received, that bit set is updated; the bit corresponding to the seqno is set to 1. A task linked to the range periodically retransmits missing messages.

  When all bits are 1 (= all messages have been received), the range is removed from the hashmap and the retransmission task is cancelled.
  Author:
    Bela Ban

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `protected class` | `RangeBasedRetransmitter.RangeTask`

    - ### Nested classes/interfaces inherited from class org.jgroups.stack.Retransmitter

      `Retransmitter.RetransmitCommand, Retransmitter.Task`

  - ### Field Summary

    - ### Fields inherited from class org.jgroups.stack.Retransmitter

      `cmd, log, RETRANSMIT_TIMEOUTS, sender, timer`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `RangeBasedRetransmitter(Address sender, Retransmitter.RetransmitCommand cmd, TimeScheduler sched)` Create a new Retransmitter associated with the given sender address

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(long first_seqno, long last_seqno)` Add the given range [first_seqno, last_seqno] in the list of entries eligible for retransmission.
    `java.lang.String` | `printStats()`
    `int` | `remove(long seqno)` Remove the given sequence number from the list of seqnos eligible for retransmission.
    `void` | `reset()` Reset the retransmitter: clear all msgs and cancel all the respective tasks
    `int` | `size()`
    `java.lang.String` | `toString()`

    - ### Methods inherited from class org.jgroups.stack.Retransmitter

      `setRetransmitTimeouts`

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

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

- - ### Constructor Detail

    - #### RangeBasedRetransmitter

          public RangeBasedRetransmitter(Address sender,
                                 Retransmitter.RetransmitCommand cmd,
                                 TimeScheduler sched)

      Create a new Retransmitter associated with the given sender address
      Parameters:
        `sender` - the address from which retransmissions are expected or to which retransmissions are sent
        `cmd` - the retransmission callback reference
        `sched` - retransmissions scheduler

  - ### Method Detail

    - #### add

          public void add(long first_seqno,
                 long last_seqno)

      Add the given range [first_seqno, last_seqno] in the list of entries eligible for retransmission. If first_seqno > last_seqno, then the range [last_seqno, first_seqno] is added instead
      Specified by:
        `add` in class `Retransmitter`

    - #### remove

          public int remove(long seqno)

      Remove the given sequence number from the list of seqnos eligible for retransmission. If there are no more seqno intervals in the respective entry, cancel the entry from the retransmission scheduler and remove it from the pending entries
      Specified by:
        `remove` in class `Retransmitter`

    - #### reset

          public void reset()

      Reset the retransmitter: clear all msgs and cancel all the respective tasks
      Specified by:
        `reset` in class `Retransmitter`

    - #### toString

          public java.lang.String toString()

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

    - #### size

          public int size()

      Specified by:
        `size` in class `Retransmitter`

    - #### printStats

          public java.lang.String printStats()

Copyright © 1998-2009 Bela Ban / Red Hat. All Rights Reserved.