Rice Pastry API

rice.pastry.multiring
Class MultiRingAppl

java.lang.Object
  |
  +--rice.pastry.client.PastryAppl
        |
        +--rice.pastry.multiring.MultiRingAppl
All Implemented Interfaces:
IScribeApp, MessageReceiver, java.io.Serializable

public class MultiRingAppl
extends PastryAppl
implements IScribeApp, java.io.Serializable

Class which represents a pastry node which is in multiple rings. It internally contains a pastry node for each seperate ring, and has logic for routing messages between the nodes. Note that the pastry nodes in all of the different rings have the same NodeId.

Version:
$Id: MultiRingAppl.java,v 1.6 2003/03/22 08:14:34 druschel Exp $
Author:
Alan Mislove
See Also:
Serialized Form

Field Summary
static int REMINDER_TIMEOUT
           
 
Fields inherited from class rice.pastry.client.PastryAppl
address, instance, thePastryNode
 
Constructor Summary
protected MultiRingAppl(rice.pastry.multiring.MultiRingPastryNode node)
          Constructor
 
Method Summary
 void addRing(rice.pastry.multiring.RingId ringId)
           
 boolean anycastHandler(rice.scribe.messaging.ScribeMessage msg)
          Invoked by underlying scribe when it receives a anycast Message, to check if there is a local application which can take care of this anycast message.
 void faultHandler(rice.scribe.messaging.ScribeMessage msg, rice.pastry.NodeHandle faultyParent)
          Invoked by Scribe just before the "repair" SUBSCRIBE message is sent when a node suspects its parent is faulty.
 void forwardHandler(rice.scribe.messaging.ScribeMessage msg)
          Called by Scribe before the node forwards a message to its children in the multicast tree.
 rice.pastry.messaging.Address getAddress()
          Returns the address of this application.
 rice.pastry.security.Credentials getCredentials()
          Returns the credentials of this application.
 rice.pastry.multiring.RingId getRingId()
           
protected  rice.scribe.Scribe getScribe()
           
 void isNewRoot(rice.pastry.NodeId topicId)
          Upcall made by scribe to registered applications to inform them that local node is now the root for some topic, and hence can take appropriate action.
 void messageForAppl(rice.pastry.messaging.Message msg)
          Called by pastry when a message arrives for this application.
 void newParent(rice.pastry.NodeId topicId, rice.pastry.NodeHandle newParent, java.io.Serializable data)
          Upcall made by scribe to the registered applications to inform them that a new parent is found for local node in the topic tree.
 void receiveMessage(rice.scribe.messaging.ScribeMessage msg)
          Called by Scribe when a multicast message arrives.
protected  void routeMultiRingMessage(rice.pastry.routing.RouteMessage rm)
           
protected  void routeMultiRingMessage(rice.pastry.routing.RouteMessage rm, rice.pastry.multiring.RingId ringId)
           
 void scribeIsReady()
          Invoked when the underlying Scribe substrate is ready.
 void subscribeHandler(rice.pastry.NodeId topicId, rice.pastry.NodeHandle child, boolean wasAdded, java.io.Serializable obj)
          Invoked by Scribe after a child is added to or removed from one of the node's children tables.
 
Methods inherited from class rice.pastry.client.PastryAppl
enrouteMessage, getLeafSet, getNodeHandle, getNodeId, getRoutingTable, isClosest, leafSetChange, notifyReady, receiveMessage, registerReceiver, routeMsg, routeMsgDirect, routeSetChange, sendMessage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REMINDER_TIMEOUT

public static int REMINDER_TIMEOUT
Constructor Detail

MultiRingAppl

protected MultiRingAppl(rice.pastry.multiring.MultiRingPastryNode node)
Constructor

Method Detail

addRing

public void addRing(rice.pastry.multiring.RingId ringId)

getScribe

protected rice.scribe.Scribe getScribe()

getRingId

public rice.pastry.multiring.RingId getRingId()

messageForAppl

public void messageForAppl(rice.pastry.messaging.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.

routeMultiRingMessage

protected void routeMultiRingMessage(rice.pastry.routing.RouteMessage rm)

routeMultiRingMessage

protected void routeMultiRingMessage(rice.pastry.routing.RouteMessage rm,
                                     rice.pastry.multiring.RingId ringId)

anycastHandler

public boolean anycastHandler(rice.scribe.messaging.ScribeMessage msg)
Description copied from interface: IScribeApp
Invoked by underlying scribe when it receives a anycast Message, to check if there is a local application which can take care of this anycast message. If application can service the request of anycast message, the anycast message is not routed furthur(for DFS), else the anycast message will be furthur routed following DFS.

Specified by:
anycastHandler in interface IScribeApp
Parameters:
msg - The corresponding Anycast message
Returns:
Whether local application was able to satisfy the request of anycast message.

getAddress

public rice.pastry.messaging.Address getAddress()
Description copied from class: PastryAppl
Returns the address of this application.

Overrides:
getAddress in class PastryAppl
Returns:
the address.

getCredentials

public rice.pastry.security.Credentials getCredentials()
Description copied from class: PastryAppl
Returns the credentials of this application.

Specified by:
getCredentials in class PastryAppl
Returns:
the credentials.

isNewRoot

public void isNewRoot(rice.pastry.NodeId topicId)
Description copied from interface: IScribeApp
Upcall made by scribe to registered applications to inform them that local node is now the root for some topic, and hence can take appropriate action.

Specified by:
isNewRoot in interface IScribeApp
Parameters:
topicId - The topic for which local node is the new root.

newParent

public void newParent(rice.pastry.NodeId topicId,
                      rice.pastry.NodeHandle newParent,
                      java.io.Serializable data)
Description copied from interface: IScribeApp
Upcall made by scribe to the registered applications to inform them that a new parent is found for local node in the topic tree.

Specified by:
newParent in interface IScribeApp
Parameters:
topicId - The topic for which new parent is found
newParent - The new parent
data - The data received with the ACK message.

scribeIsReady

public void scribeIsReady()
Description copied from interface: IScribeApp
Invoked when the underlying Scribe substrate is ready. The Scribe substrate becomes ready as soon as the local Pastry node on which it lies is ready. In order to get this upcall it is necessary that the IScribeApp registers itself to the Scribe substrate using the registerApp() method in IScribe interface.

Specified by:
scribeIsReady in interface IScribeApp

receiveMessage

public void receiveMessage(rice.scribe.messaging.ScribeMessage msg)
Description copied from interface: IScribeApp
Called by Scribe when a multicast message arrives.

Specified by:
receiveMessage in interface IScribeApp
Parameters:
msg - The message sent in the PUBLISH message.

forwardHandler

public void forwardHandler(rice.scribe.messaging.ScribeMessage msg)
Description copied from interface: IScribeApp
Called by Scribe before the node forwards a message to its children in the multicast tree.

Specified by:
forwardHandler in interface IScribeApp
Parameters:
msg - The message about to be forwarded.

subscribeHandler

public void subscribeHandler(rice.pastry.NodeId topicId,
                             rice.pastry.NodeHandle child,
                             boolean wasAdded,
                             java.io.Serializable obj)
Description copied from interface: IScribeApp
Invoked by Scribe after a child is added to or removed from one of the node's children tables.

Specified by:
subscribeHandler in interface IScribeApp
Parameters:
topicId - The topic for which child was added or removed.
child - The corresponding child.
wasAdded - true if child was added and false if child was removed.
obj - The additional data associated with the subscription message, SUBSCRIBE msg, sent by the "original" child, not the forwarding node.

faultHandler

public void faultHandler(rice.scribe.messaging.ScribeMessage msg,
                         rice.pastry.NodeHandle faultyParent)
Description copied from interface: IScribeApp
Invoked by Scribe just before the "repair" SUBSCRIBE message is sent when a node suspects its parent is faulty.

Specified by:
faultHandler in interface IScribeApp
Parameters:
msg - The SUBSCRIBE message that is sent to repair the multicast tree.
faultyParent - The suspected faulty parent.

Rice Pastry API

Copyright © 2001 - Rice Pastry.


Imprint-Dataprotection