rice.pastry.wire
Class DatagramTransmissionManager

java.lang.Object
  extended byrice.pastry.wire.DatagramTransmissionManager

public class DatagramTransmissionManager
extends java.lang.Object

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.


Field Summary
static int BEGIN_ACK_NUM
          the first 'ack' number to use
 
Constructor Summary
DatagramTransmissionManager(WirePastryNode spn, java.nio.channels.SelectionKey key, DatagramManager dm)
          Builds a transmission manager for a given pastry node using a given key.
 
Method Summary
 void add(PendingWrite write)
          Adds a pending write to the queue.
 void enableWrite(boolean write, java.lang.String reason)
          This method controls the key's write interestOp, and has a parallel boolean to improve performance.
 java.util.Iterator getReady()
          Returns an iterator over the pending writes ready to be written.
 void notifyKilled()
          notifys all of the TransmissionEntries that they have been killed.
 void receivedAck(AcknowledgementMessage message)
          Callback mechanism designed to be called when an ack packet is received.
 void resetAckNumber(NodeId node)
          Resets the sequence number for the specified node
 void wakeup()
          Designed to be called periodically in order for the Transmission Manager to decide if a packet has been lost.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BEGIN_ACK_NUM

public static int BEGIN_ACK_NUM
the first 'ack' number to use

Constructor Detail

DatagramTransmissionManager

public DatagramTransmissionManager(WirePastryNode spn,
                                   java.nio.channels.SelectionKey key,
                                   DatagramManager dm)
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

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.

notifyKilled

public void notifyKilled()
notifys all of the TransmissionEntries that they have been killed. This method has logic to guarantee that it only calls notifyKilled on the TransmissionEntries once.


add

public void add(PendingWrite write)
Adds a pending write to the queue.

Parameters:
write - The pending write to add.

receivedAck

public void receivedAck(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:
message - The ack that was received.

wakeup

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


enableWrite

public void enableWrite(boolean write,
                        java.lang.String reason)
This method controls the key's write interestOp, and has a parallel boolean to improve performance. The actual interestOp is only called if the state changes.

Parameters:
write - new boolean for key's write interestOp
reason - used for logging, the reason the state is changing

resetAckNumber

public void resetAckNumber(NodeId node)
Resets the sequence number for the specified node

Parameters:
node - The node to reset





Imprint-Dataprotection