Rice Pastry API

rice.pastry.multiring
Class MultiRingPastryNode

java.lang.Object
  |
  +--rice.pastry.PastryNode
        |
        +--rice.pastry.multiring.MultiRingPastryNode
All Implemented Interfaces:
MessageReceiver, Node

public class MultiRingPastryNode
extends PastryNode

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: MultiRingPastryNode.java,v 1.6 2003/03/22 07:24:35 amislove Exp $
Author:
Alan Mislove

Field Summary
static rice.pastry.multiring.RingId GLOBAL_RING_ID
           
 
Fields inherited from class rice.pastry.PastryNode
apps, localhandle, myNodeId
 
Constructor Summary
protected MultiRingPastryNode(rice.pastry.PastryNode primaryNode)
          Which takes in the first "real" pastry node.
 
Method Summary
 void addChildPastryNode(rice.pastry.multiring.MultiRingPastryNode child)
           
 void addLeafSetObserver(java.util.Observer o)
          Add a leaf set observer to the Pastry node.
 void addRouteSetObserver(java.util.Observer o)
          Add a route set observer to the Pastry node.
 void broadcastRingId(rice.pastry.multiring.RingId ringId)
           
 void deleteLeafSetObserver(java.util.Observer o)
          Delete a leaf set observer from the Pastry node.
 void deleteRouteSetObserver(java.util.Observer o)
          Delete a route set observer from the Pastry node.
 rice.pastry.leafset.LeafSet getLeafSet()
           
 rice.pastry.NodeHandle getLocalHandle()
           
 rice.pastry.messaging.MessageDispatch getMessageDispatch()
          FOR TESTING ONLY - DO NOT USE!
 rice.pastry.multiring.MultiRingAppl getMultiRingAppl()
           
 rice.pastry.NodeId getNodeId()
           
protected  rice.pastry.multiring.MultiRingPastryNode getParent()
           
 rice.pastry.PastryNode getPastryNode()
           
 rice.pastry.multiring.RingId getRingId()
           
 rice.pastry.routing.RoutingTable getRoutingTable()
           
 rice.scribe.Scribe getScribe()
           
 void initiateJoin(rice.pastry.NodeHandle bootstrap)
          Overridden by derived classes to initiate the join process
 boolean isClosest(rice.pastry.NodeId key)
          Called by the layered Pastry application to check if the local pastry node is the one that is currently closest to the object key id.
 boolean isReady()
           
 void nodeIsReady()
          Overridden by derived classes, and invoked when the node has joined successfully.
 void processMessage(rice.pastry.messaging.Message msg)
           
 void receiveMessage(rice.pastry.messaging.Message m)
          message receiver interface.
 void registerApp(rice.pastry.client.PastryAppl app)
          Registers an application with this pastry node.
 void registerReceiver(rice.pastry.security.Credentials cred, rice.pastry.messaging.Address address, rice.pastry.messaging.MessageReceiver receiver)
          Registers a message receiver with this Pastry node.
 rice.pastry.ScheduledMessage scheduleMsg(rice.pastry.messaging.Message msg, long delay)
          Schedule the specified message to be sent to the local node after a specified delay.
 rice.pastry.ScheduledMessage scheduleMsg(rice.pastry.messaging.Message msg, long delay, long period)
          Schedule the specified message for repeated fixed-delay delivery to the local node, beginning after the specified delay.
 rice.pastry.ScheduledMessage scheduleMsgAtFixedRate(rice.pastry.messaging.Message msg, long delay, long period)
          Schedule the specified message for repeated fixed-rate delivery to the local node, beginning after the specified delay.
 void setBootstrap(rice.pastry.NodeHandle bootstrap)
           
 void setElements(rice.pastry.NodeHandle lh, rice.pastry.security.PastrySecurityManager sm, rice.pastry.messaging.MessageDispatch md, rice.pastry.leafset.LeafSet ls, rice.pastry.routing.RoutingTable rt)
          Combined accessor method for various members of PastryNode.
 void setMessageDispatch(rice.pastry.messaging.MessageDispatch md)
           
 void setParentPastryNode(rice.pastry.multiring.MultiRingPastryNode parent)
           
 void setReady()
           
 java.lang.String toString()
           
 
Methods inherited from class rice.pastry.PastryNode
getId, getIdFactory, registerApplication
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

GLOBAL_RING_ID

public static rice.pastry.multiring.RingId GLOBAL_RING_ID
Constructor Detail

MultiRingPastryNode

protected MultiRingPastryNode(rice.pastry.PastryNode primaryNode)
Which takes in the first "real" pastry node. This should only be called from the factory.

Method Detail

getPastryNode

public rice.pastry.PastryNode getPastryNode()

getRingId

public rice.pastry.multiring.RingId getRingId()

getScribe

public rice.scribe.Scribe getScribe()

processMessage

public void processMessage(rice.pastry.messaging.Message msg)

setBootstrap

public void setBootstrap(rice.pastry.NodeHandle bootstrap)

setParentPastryNode

public void setParentPastryNode(rice.pastry.multiring.MultiRingPastryNode parent)

addChildPastryNode

public void addChildPastryNode(rice.pastry.multiring.MultiRingPastryNode child)

broadcastRingId

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

getMultiRingAppl

public rice.pastry.multiring.MultiRingAppl getMultiRingAppl()

getParent

protected rice.pastry.multiring.MultiRingPastryNode getParent()

receiveMessage

public void receiveMessage(rice.pastry.messaging.Message m)
Description copied from class: PastryNode
message receiver interface. synchronized so that the external message processing thread and the leafset/route maintenance thread won't interfere with application messages.

Specified by:
receiveMessage in interface MessageReceiver
Overrides:
receiveMessage in class PastryNode
Parameters:
m - the message.

getMessageDispatch

public rice.pastry.messaging.MessageDispatch getMessageDispatch()
Description copied from class: PastryNode
FOR TESTING ONLY - DO NOT USE!

Overrides:
getMessageDispatch in class PastryNode

setMessageDispatch

public void setMessageDispatch(rice.pastry.messaging.MessageDispatch md)
Overrides:
setMessageDispatch in class PastryNode

setElements

public final void setElements(rice.pastry.NodeHandle lh,
                              rice.pastry.security.PastrySecurityManager sm,
                              rice.pastry.messaging.MessageDispatch md,
                              rice.pastry.leafset.LeafSet ls,
                              rice.pastry.routing.RoutingTable rt)
Description copied from class: PastryNode
Combined accessor method for various members of PastryNode. These are generated by node factories, and assigned here. Other elements specific to the wire protocol are assigned via methods set{RMI,Direct}Elements in the respective derived classes.

Overrides:
setElements in class PastryNode
Parameters:
lh - Node handle corresponding to this node.
sm - Security manager.
md - Message dispatcher.
ls - Leaf set.
rt - Routing table.

getLocalHandle

public rice.pastry.NodeHandle getLocalHandle()
Overrides:
getLocalHandle in class PastryNode

getNodeId

public rice.pastry.NodeId getNodeId()
Overrides:
getNodeId in class PastryNode

isReady

public boolean isReady()
Overrides:
isReady in class PastryNode

nodeIsReady

public void nodeIsReady()
Description copied from class: PastryNode
Overridden by derived classes, and invoked when the node has joined successfully.

Specified by:
nodeIsReady in class PastryNode

setReady

public void setReady()
Overrides:
setReady in class PastryNode

isClosest

public boolean isClosest(rice.pastry.NodeId key)
Description copied from class: PastryNode
Called by the layered Pastry application to check if the local pastry node is the one that is currently closest to the object key id.

Overrides:
isClosest in class PastryNode
Parameters:
key - the object key id
Returns:
true if the local node is currently the closest to the key.

getLeafSet

public rice.pastry.leafset.LeafSet getLeafSet()
Overrides:
getLeafSet in class PastryNode

getRoutingTable

public rice.pastry.routing.RoutingTable getRoutingTable()
Overrides:
getRoutingTable in class PastryNode

initiateJoin

public void initiateJoin(rice.pastry.NodeHandle bootstrap)
Description copied from class: PastryNode
Overridden by derived classes to initiate the join process

Specified by:
initiateJoin in class PastryNode
Parameters:
bootstrap - Node handle to bootstrap with.

addLeafSetObserver

public void addLeafSetObserver(java.util.Observer o)
Description copied from class: PastryNode
Add a leaf set observer to the Pastry node.

Overrides:
addLeafSetObserver in class PastryNode
Parameters:
o - the observer.

deleteLeafSetObserver

public void deleteLeafSetObserver(java.util.Observer o)
Description copied from class: PastryNode
Delete a leaf set observer from the Pastry node.

Overrides:
deleteLeafSetObserver in class PastryNode
Parameters:
o - the observer.

addRouteSetObserver

public void addRouteSetObserver(java.util.Observer o)
Description copied from class: PastryNode
Add a route set observer to the Pastry node.

Overrides:
addRouteSetObserver in class PastryNode
Parameters:
o - the observer.

deleteRouteSetObserver

public void deleteRouteSetObserver(java.util.Observer o)
Description copied from class: PastryNode
Delete a route set observer from the Pastry node.

Overrides:
deleteRouteSetObserver in class PastryNode
Parameters:
o - the observer.

registerReceiver

public void registerReceiver(rice.pastry.security.Credentials cred,
                             rice.pastry.messaging.Address address,
                             rice.pastry.messaging.MessageReceiver receiver)
Description copied from class: PastryNode
Registers a message receiver with this Pastry node.

Overrides:
registerReceiver in class PastryNode
Parameters:
cred - the credentials.
address - the address that the receiver will be at.
receiver - the message receiver.

registerApp

public void registerApp(rice.pastry.client.PastryAppl app)
Description copied from class: PastryNode
Registers an application with this pastry node.

Overrides:
registerApp in class PastryNode
Parameters:
app - the application

scheduleMsg

public rice.pastry.ScheduledMessage scheduleMsg(rice.pastry.messaging.Message msg,
                                                long delay)
Description copied from class: PastryNode
Schedule the specified message to be sent to the local node after a specified delay. Useful to provide timeouts.

Specified by:
scheduleMsg in class PastryNode
Parameters:
msg - a message that will be delivered to the local node after the specified delay
delay - time in milliseconds before message is to be delivered
Returns:
the scheduled event object; can be used to cancel the message

scheduleMsg

public rice.pastry.ScheduledMessage scheduleMsg(rice.pastry.messaging.Message msg,
                                                long delay,
                                                long period)
Description copied from class: PastryNode
Schedule the specified message for repeated fixed-delay delivery to the local node, beginning after the specified delay. Subsequent executions take place at approximately regular intervals separated by the specified period. Useful to initiate periodic tasks.

Specified by:
scheduleMsg in class PastryNode
Parameters:
msg - a message that will be delivered to the local node after the specified delay
delay - time in milliseconds before message is to be delivered
period - time in milliseconds between successive message deliveries
Returns:
the scheduled event object; can be used to cancel the message

scheduleMsgAtFixedRate

public rice.pastry.ScheduledMessage scheduleMsgAtFixedRate(rice.pastry.messaging.Message msg,
                                                           long delay,
                                                           long period)
Description copied from class: PastryNode
Schedule the specified message for repeated fixed-rate delivery to the local node, beginning after the specified delay. Subsequent executions take place at approximately regular intervals, separated by the specified period.

Specified by:
scheduleMsgAtFixedRate in class PastryNode
Parameters:
msg - a message that will be delivered to the local node after the specified delay
delay - time in milliseconds before message is to be delivered
period - time in milliseconds between successive message deliveries
Returns:
the scheduled event object; can be used to cancel the message

toString

public java.lang.String toString()
Overrides:
toString in class PastryNode

Rice Pastry API

Copyright © 2001 - Rice Pastry.


Imprint-Dataprotection