Rice Pastry API

rice.pastry.rmi
Class RMIPastryNodeFactory

java.lang.Object
  |
  +--rice.pastry.PastryNodeFactory
        |
        +--rice.pastry.dist.DistPastryNodeFactory
              |
              +--rice.pastry.rmi.RMIPastryNodeFactory

public class RMIPastryNodeFactory
extends DistPastryNodeFactory

Pastry node factory for RMI-linked nodes.

Version:
$Id: RMIPastryNodeFactory.java,v 1.40 2003/09/27 02:49:47 amislove Exp $
Author:
Andrew Ladd, Sitaram Iyer

Field Summary
static int DEFAULT_REGISTRY_PORT
           
static int NUM_ATTEMPTS
           
static java.rmi.registry.Registry rmiRegistry
          Instance of RMI registry ever-created when using this factory.
 
Fields inherited from class rice.pastry.dist.DistPastryNodeFactory
PROTOCOL_RMI, PROTOCOL_WIRE
 
Constructor Summary
RMIPastryNodeFactory(rice.pastry.NodeIdFactory nf, int p)
          Constructor.
 
Method Summary
 rice.pastry.NodeHandle generateNodeHandle(java.net.InetSocketAddress address)
          Specified by the DistPastryNodeFactory class.
 rice.pastry.leafset.LeafSet getLeafSet(rice.pastry.NodeHandle handle)
          This method returns the remote leafset of the provided handle to the caller, in a protocol-dependent fashion.
 int getProximity(rice.pastry.NodeHandle local, rice.pastry.NodeHandle handle)
          This method determines and returns the proximity of the current local node the provided NodeHandle.
 rice.pastry.routing.RouteSet[] getRouteRow(rice.pastry.NodeHandle handle, int row)
          This method returns the remote route row of the provided handle to the caller, in a protocol-dependent fashion.
 rice.pastry.PastryNode newNode(rice.pastry.NodeHandle bootstrap)
          Generates a new pastry node with a random NodeId using the bootstrap bootstrap.
 rice.pastry.PastryNode newNode(rice.pastry.NodeHandle bootstrap, rice.pastry.NodeId nodeId)
          Makes many policy choices and manufactures a new RMIPastryNode.
 void pause(int ms)
          Pauses the current thread for ms milliseconds.
 
Methods inherited from class rice.pastry.dist.DistPastryNodeFactory
getFactory, getNodeHandle
 
Methods inherited from class rice.pastry.PastryNodeFactory
getNearest
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NUM_ATTEMPTS

public static int NUM_ATTEMPTS

DEFAULT_REGISTRY_PORT

public static int DEFAULT_REGISTRY_PORT

rmiRegistry

public static java.rmi.registry.Registry rmiRegistry
Instance of RMI registry ever-created when using this factory.

Constructor Detail

RMIPastryNodeFactory

public RMIPastryNodeFactory(rice.pastry.NodeIdFactory nf,
                            int p)
Constructor.

Parameters:
p - RMI registry port.
Method Detail

generateNodeHandle

public rice.pastry.NodeHandle generateNodeHandle(java.net.InetSocketAddress address)
Specified by the DistPastryNodeFactory class. The first looks on the local machine (at the port p) to determine if there is an node bound there. If so, it retrieves the rmiNodeHanlde from that node. If not, this method then looks at the address address to see if there is a pastry node bound there.

Specified by:
generateNodeHandle in class DistPastryNodeFactory
Parameters:
address - The address to look for the node.
Returns:
A NodeHandle cooresponding to the remote node at address, or null if none is found.

pause

public void pause(int ms)
Pauses the current thread for ms milliseconds.

Parameters:
ms - The number of milliseconds to pause.

newNode

public rice.pastry.PastryNode newNode(rice.pastry.NodeHandle bootstrap)
Description copied from class: DistPastryNodeFactory
Generates a new pastry node with a random NodeId using the bootstrap bootstrap.

Specified by:
newNode in class DistPastryNodeFactory
Parameters:
bootstrap - Node handle to bootstrap from.

newNode

public rice.pastry.PastryNode newNode(rice.pastry.NodeHandle bootstrap,
                                      rice.pastry.NodeId nodeId)
Makes many policy choices and manufactures a new RMIPastryNode. Creates a series of artifacts to adorn the node, like a security manager, a leafset, etc. with hand-picked parameters like the leaf set size. Finally calls the respective setElements to pass these on to the {,RMI,Direct}PastryNode as appropriate, and then calls node.doneNode() (which internally performs mechanisms like exporting the node and notifying applications).

Specified by:
newNode in class DistPastryNodeFactory
Parameters:
bootstrap - Node handle to bootstrap from.

getLeafSet

public rice.pastry.leafset.LeafSet getLeafSet(rice.pastry.NodeHandle handle)
This method returns the remote leafset of the provided handle to the caller, in a protocol-dependent fashion. Note that this method may block while sending the message across the wire.

Specified by:
getLeafSet in class PastryNodeFactory
Parameters:
handle - The node to connect to
Returns:
The leafset of the remote node

getRouteRow

public rice.pastry.routing.RouteSet[] getRouteRow(rice.pastry.NodeHandle handle,
                                                  int row)
This method returns the remote route row of the provided handle to the caller, in a protocol-dependent fashion. Note that this method may block while sending the message across the wire.

Specified by:
getRouteRow in class PastryNodeFactory
Parameters:
handle - The node to connect to
row - The row number to retrieve
Returns:
The route row of the remote node

getProximity

public int getProximity(rice.pastry.NodeHandle local,
                        rice.pastry.NodeHandle handle)
This method determines and returns the proximity of the current local node the provided NodeHandle. This will need to be done in a protocol- dependent fashion and may need to be done in a special way.

Specified by:
getProximity in class PastryNodeFactory
Parameters:
handle - The handle to determine the proximity of
Returns:
The proximity of the provided handle

Rice Pastry API

Copyright © 2001 - Rice Pastry.


Imprint-Dataprotection