public class Retransmitter
extends java.lang.Object
add()
method adds the sequence numbers of messages to be retransmitted. The
remove()
method removes a sequence number again, cancelling retransmission requests for it.
Whenever a message needs to be retransmitted, the RetransmitCommand.retransmit()
method is called.
It can be used e.g. by an ack-based scheme (e.g. AckSenderWindow) to retransmit a message to the receiver, or
by a nak-based scheme to send a retransmission request to the sender of the missing message.Modifier and Type | Class | Description |
---|---|---|
static interface |
Retransmitter.RetransmitCommand |
Retransmit command (see Gamma et al.) used to retrieve missing messages
|
Modifier and Type | Field | Description |
---|---|---|
protected static org.apache.commons.logging.Log |
log |
Constructor | Description |
---|---|
Retransmitter(Address sender,
Retransmitter.RetransmitCommand cmd) |
Create a new Retransmitter associated with the given sender address
|
Retransmitter(Address sender,
Retransmitter.RetransmitCommand cmd,
TimeScheduler sched) |
Create a new Retransmitter associated with the given sender address
|
Modifier and Type | Method | 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.
|
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
|
void |
setRetransmitTimeouts(Interval interval) |
|
int |
size() |
|
void |
stop() |
Stop the rentransmition and clear all pending msgs.
|
java.lang.String |
toString() |
public Retransmitter(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 Retransmitter(Address sender, Retransmitter.RetransmitCommand cmd)
sender
- the address from which retransmissions are expected or to which retransmissions are sentcmd
- the retransmission callback referencepublic void setRetransmitTimeouts(Interval interval)
public void add(long first_seqno, long last_seqno)
If retransmitter thread is suspended, wake it up
public int remove(long seqno)
public void reset()
public void stop()
If this retransmitter has been provided an externally managed scheduler, then just clear all msgs and the associated tasks, else stop the scheduler. In this case the method blocks until the scheduler's thread is dead. Only the owner of the scheduler should stop it.
public java.lang.String toString()
toString
in class java.lang.Object
public int size()
Copyright ? 1998-2008 Bela Ban. All Rights Reserved.