Rice Pastry API

rice.pastry.standard
Class StandardRouter

java.lang.Object
  extended by rice.pastry.client.PastryAppl
      extended by rice.pastry.standard.StandardRouter
All Implemented Interfaces:
Router
Direct Known Subclasses:
RapidRerouter

public class StandardRouter
extends PastryAppl
implements Router

An implementation of the standard Pastry routing algorithm.

Version:
$Id: StandardRouter.java 3822 2007-08-07 14:00:39Z jeffh $
Author:
Andrew Ladd, Rongmei Zhang/Y.Charlie Hu

Field Summary
protected  java.util.Map<NodeHandle,java.lang.Long> lastTimeSentRouteTablePatch
          We can end up causing a nasty feeback if we blast too many BRRs, so we're going to throttle.
protected  int ROUTE_TABLE_PATCH_THROTTLE
           
 
Fields inherited from class rice.pastry.client.PastryAppl
address, deserializer, instance, logger, options, receiver, thePastryNode
 
Constructor Summary
StandardRouter(PastryNode thePastryNode, MessageDispatch dispatch)
          Constructor.
 
Method Summary
 void deliverToApplication(RouteMessage msg)
           
 boolean deliverWhenNotReady()
          Instructs the MessageDispatch how to behave when the PastryNode is not ready.
 void messageForAppl(Message msg)
          Called by pastry when a message arrives for this application.
 void receiveMessage(Message msg)
          Receive a message from a remote node.
 void route(RouteMessage rm)
           
 boolean routeMessage(RouteMessage rm)
          Routes the messages if the next hop has been set up.
protected  void sendTheMessage(RouteMessage rm, NodeHandle handle)
           
 
Methods inherited from class rice.pastry.client.PastryAppl
accept, canReceiveSocket, connect, destroy, enrouteMessage, finishReceiveSocket, getAddress, getDeserializer, getLeafSet, getNodeHandle, getNodeId, getRoutingTable, isClosest, leafSetChange, notifyReady, receiveMessageInternal, register, routeMsg, routeMsgDirect, routeSetChange, setDeserializer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ROUTE_TABLE_PATCH_THROTTLE

protected int ROUTE_TABLE_PATCH_THROTTLE

lastTimeSentRouteTablePatch

protected java.util.Map<NodeHandle,java.lang.Long> lastTimeSentRouteTablePatch
We can end up causing a nasty feeback if we blast too many BRRs, so we're going to throttle.

Constructor Detail

StandardRouter

public StandardRouter(PastryNode thePastryNode,
                      MessageDispatch dispatch)
Constructor.

Parameters:
rt - the routing table.
ls - the leaf set.
Method Detail

receiveMessage

public void receiveMessage(Message msg)
Receive a message from a remote node.

Overrides:
receiveMessage in class PastryAppl
Parameters:
msg - the message.

route

public void route(RouteMessage rm)
Specified by:
route in interface Router

routeMessage

public boolean routeMessage(RouteMessage rm)
Routes the messages if the next hop has been set up. Note, this once lived in the RouteMessaage

Parameters:
localId - the node id of the local node.
Returns:
true if the message got routed, false otherwise.

sendTheMessage

protected void sendTheMessage(RouteMessage rm,
                              NodeHandle handle)

deliverToApplication

public void deliverToApplication(RouteMessage msg)

deliverWhenNotReady

public boolean deliverWhenNotReady()
Description copied from class: PastryAppl
Instructs the MessageDispatch how to behave when the PastryNode is not ready. An application can override this method to return true if it wishes to receive messages before Pastry is ready(). Most applications should leave this as false, so that their application does not have inconsistent routing. However Pastry's protocols (such as the join protocol) need to receive messages before pastry is ready(). This is because they are attempting to make pastry ready().

Overrides:
deliverWhenNotReady in class PastryAppl
Returns:
false unless the node is a service

messageForAppl

public void messageForAppl(Message msg)
Description copied from class: PastryAppl
Called by pastry when a message arrives for this application.

Specified by:
messageForAppl in class PastryAppl
Parameters:
msg - the message that is arriving.

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection