|
Rice Pastry API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object rice.pastry.client.PastryAppl rice.pastry.standard.StandardRouter
public class StandardRouter
An implementation of the standard Pastry routing algorithm.
Field Summary | |
---|---|
protected java.util.Map<NodeHandle,java.lang.Long> |
lastTimeSentRouteTablePatch
We can end up causing a nasty feedback if we blast too many BRRs, so we're going to throttle. |
protected int |
ROUTE_TABLE_PATCH_THROTTLE
|
protected RouterStrategy |
routerStrategy
|
Fields inherited from class rice.pastry.client.PastryAppl |
---|
address, deserializer, instance, logger, options, receiver, thePastryNode |
Constructor Summary | |
---|---|
StandardRouter(PastryNode thePastryNode,
MessageDispatch dispatch)
Constructor. |
|
StandardRouter(PastryNode thePastryNode,
MessageDispatch dispatch,
RouterStrategy strategy)
|
Method Summary | |
---|---|
void |
deliverToApplication(RouteMessage msg)
|
boolean |
deliverWhenNotReady()
Instructs the MessageDispatch how to behave when the PastryNode is not ready. |
java.util.Iterator<NodeHandle> |
getBestRoutingCandidates(Id target)
Returns an ordered list of the best candidates for the next to the key. |
protected java.util.Iterator<NodeHandle> |
getBestRoutingCandidates(Id target,
int lsPos,
boolean leafSetOnly)
|
protected java.util.ArrayList<NodeHandle> |
getLSCollection(int lsPos)
|
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)
Send the RouteMessage based on the Pastry Algorithm |
boolean |
routeMessage(RouteMessage rm)
Routes the messages if the next hop has been set up. |
protected void |
sendTheMessage(RouteMessage rm,
NodeHandle handle)
|
void |
setRouterStrategy(RouterStrategy strategy)
|
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, routeMsg, routeMsgDirect, routeSetChange, setDeserializer |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected RouterStrategy routerStrategy
protected int ROUTE_TABLE_PATCH_THROTTLE
protected java.util.Map<NodeHandle,java.lang.Long> lastTimeSentRouteTablePatch
Constructor Detail |
---|
public StandardRouter(PastryNode thePastryNode, MessageDispatch dispatch)
rt
- the routing table.ls
- the leaf set.public StandardRouter(PastryNode thePastryNode, MessageDispatch dispatch, RouterStrategy strategy)
Method Detail |
---|
public void setRouterStrategy(RouterStrategy strategy)
public void receiveMessage(Message msg)
receiveMessage
in class PastryAppl
msg
- the message.public void route(RouteMessage rm)
Router
route
in interface Router
public boolean routeMessage(RouteMessage rm)
localId
- the node id of the local node.
protected void sendTheMessage(RouteMessage rm, NodeHandle handle)
public java.util.Iterator<NodeHandle> getBestRoutingCandidates(Id target)
Router
getBestRoutingCandidates
in interface Router
msg
- the message to setNextHop() ontarget
- the destination IdlsPos
- the best leafSet candidate
protected java.util.Iterator<NodeHandle> getBestRoutingCandidates(Id target, int lsPos, boolean leafSetOnly)
protected java.util.ArrayList<NodeHandle> getLSCollection(int lsPos)
public void deliverToApplication(RouteMessage msg)
public boolean deliverWhenNotReady()
PastryAppl
deliverWhenNotReady
in class PastryAppl
public void messageForAppl(Message msg)
PastryAppl
messageForAppl
in class PastryAppl
msg
- the message that is arriving.
|
Rice Pastry API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |