rice.pastry.testing
Class HelloWorldApp
- public class HelloWorldApp
- extends rice.pastry.client.PastryAppl
- A hello world example for pastry. This is the per-node app object.
- Version:
- $Id: HelloWorldApp.java,v 1.7 2002/09/06 22:58:18 atuls Exp $
- Author:
- Sitaram Iyer
sendRndMsg
public void sendRndMsg(java.util.Random rng)
- Sends a message to a randomly chosen node. Yeah, for fun.
- Parameters:
rng
- Random number generator.
getAddress
public rice.pastry.messaging.Address getAddress()
- Get address.
- Returns:
- the address of this application.
getCredentials
public rice.pastry.security.Credentials getCredentials()
- Get credentials.
- Returns:
- credentials.
messageForAppl
public void messageForAppl(rice.pastry.messaging.Message msg)
- Invoked on destination node when a message arrives.
- Parameters:
msg
- Message being routed around
enrouteMessage
public boolean enrouteMessage(rice.pastry.messaging.Message msg,
rice.pastry.NodeId key,
rice.pastry.NodeId nextHop,
rice.pastry.routing.SendOptions opt)
- Invoked on intermediate nodes in routing path.
- Parameters:
msg
- Message that's passing through this node.
key
- destination
nextHop
- next hop
opt
- send options
- Returns:
- true if message needs to be forwarded according to plan.
leafSetChange
public void leafSetChange(rice.pastry.NodeHandle nh,
boolean wasAdded)
- Invoked upon change to leafset.
- Parameters:
nh
- node handle that got added/removed
wasAdded
- added (true) or removed (false)
routeSetChange
public void routeSetChange(rice.pastry.NodeHandle nh,
boolean wasAdded)
- Invoked upon change to routing table.
- Parameters:
nh
- node handle that got added/removed
wasAdded
- added (true) or removed (false)
notifyReady
public void notifyReady()
- Invoked by {RMI,Direct}PastryNode when the node has something in its leaf set, and has become ready to receive application messages.