rice.pastry.wire
Class DatagramTransmissionManager

public class DatagramTransmissionManager
Class which controls which object should be transmitted in the UPD version of the pastry protocol. This class is responsible for ensuring reliable and ordered delivery of packets to their destinations. This implementation is thread-safe, so both the client and pastry thread can access it at once.
Version:
$Id: DatagramTransmissionManager.java,v 1.11 2002/09/13 15:58:43 amislove Exp $
Author:
Alan Mislove
Constructor Detail

DatagramTransmissionManager

public DatagramTransmissionManager(rice.pastry.wire.WirePastryNode spn,
                                   java.nio.channels.SelectionKey key)
Builds a transmission manager for a given pastry node using a given key.
Parameters:
spn - The pastry node this manager serves.
key - The key used by the datagram manager.

Method Detail

add

public void add(rice.pastry.wire.PendingWrite write)
Adds a pending write to the queue.
Parameters:
write - The pending write to add.

getReady

public java.util.Iterator getReady()
Returns an iterator over the pending writes ready to be written.
Returns:
An Iterator over PendingWrites, all ready to be written.

receivedAck

public void receivedAck(rice.pastry.wire.messaging.datagram.AcknowledgementMessage message)
Callback mechanism designed to be called when an ack packet is received. If there are more messasges in the queue, the appropriate entry will be set 'ready', and the next message will be sent across the wire on the next getReady() call.
Parameters:
address - The address the ack came from.
num - The number of the ack

wakeup

public void wakeup()
Designed to be called periodically in order for the Transmission Manager to decide if a packet has been lost.

resetAckNumber

public void resetAckNumber(rice.pastry.NodeId node)
Resets the sequence number for the specified node
Parameters:
node - The node to reset

getEntries

private java.lang.Object[] getEntries()
Private method which returns a iterator over all of the entries in the TransmissionManager.
Returns:
An Iterator over the TransmissionEntries in the Transmission Manager.