public class RangeBasedRetransmitter extends Retransmitter
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.
RangeBasedRetransmitter requires sequence numbers and sequence number ranges to be added in ascending and
non-overlapping order: e.g. 1 4 [10-21] 22 [50-60] is ok, while [3-7] [5-8] 20 18 is not !限定符和类型 | 类和说明 |
---|---|
protected class |
RangeBasedRetransmitter.RangeTask |
Retransmitter.RetransmitCommand, Retransmitter.Task
cmd, log, retransmit_timeouts, sender, timer, xmit_stagger_timeout
构造器和说明 |
---|
RangeBasedRetransmitter(Address sender,
Retransmitter.RetransmitCommand cmd,
TimeScheduler sched)
Create a new Retransmitter associated with the given sender address
|
限定符和类型 | 方法和说明 |
---|---|
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() |
void |
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() |
getXmitStaggerTimeout, setRetransmitTimeouts, setXmitStaggerTimeout
public RangeBasedRetransmitter(Address sender, Retransmitter.RetransmitCommand cmd, TimeScheduler sched)
sender
- the address from which retransmissions are expected or to which retransmissions are sentcmd
- the retransmission callback referencesched
- retransmissions schedulerpublic void add(long first_seqno, long last_seqno)
add
在类中 Retransmitter
public void remove(long seqno)
remove
在类中 Retransmitter
public void reset()
reset
在类中 Retransmitter
public java.lang.String toString()
toString
在类中 java.lang.Object
public int size()
size
在类中 Retransmitter
public java.lang.String printStats()