Rice Pastry API

rice.p2p.commonapi
Interface Node

All Known Implementing Classes:
GCNode, MultiringNode, PastryNode

public interface Node

Version:
$Id: Node.java 3992 2007-12-02 20:09:18Z jeffh $
Author:
Alan Mislove, Peter Druschel

Method Summary
 Endpoint buildEndpoint(Application application, java.lang.String instance)
          Same as register application, but returns an unregistered Endpoint.
 Environment getEnvironment()
          Returns the environment.
 Id getId()
          Returns the Id of this node
 IdFactory getIdFactory()
          Returns a factory for Ids specific to this node's protocol.
 NodeHandle getLocalNodeHandle()
          Returns a handle to the local node.
 java.lang.String printRouteState()
          For debugging: print the internal routing state of the Node.
 Endpoint registerApplication(Application application, java.lang.String instance)
          Deprecated. use buildEndpoint(), then call Endpoint.register(), fixes synchronization problems, related to implicit behavior
 

Method Detail

registerApplication

Endpoint registerApplication(Application application,
                             java.lang.String instance)
Deprecated. use buildEndpoint(), then call Endpoint.register(), fixes synchronization problems, related to implicit behavior

This returns a Endpoint specific to the given application and instance name to the application, which the application can then use in order to send an receive messages. This method abstracts away the port number for this application, generating a port by hashing together the class name with the instance name to generate a unique port. Developers who wish for more advanced behavior can specify their port manually, by using the second constructor below.

Parameters:
application - The Application
instance - An identifier for a given instance
Returns:
The endpoint specific to this applicationk, which can be used for message sending/receiving. Endpoint is already registered.

getId

Id getId()
Returns the Id of this node

Returns:
This node's Id

getIdFactory

IdFactory getIdFactory()
Returns a factory for Ids specific to this node's protocol.

Returns:
A factory for creating Ids.

getLocalNodeHandle

NodeHandle getLocalNodeHandle()
Returns a handle to the local node. This node handle is serializable, and can therefore be sent to other nodes in the network and still be valid.

Returns:
A NodeHandle referring to the local node.

getEnvironment

Environment getEnvironment()
Returns the environment. This allows the nodes to be virtualized within the JVM

Returns:
the environment for this node/app.

buildEndpoint

Endpoint buildEndpoint(Application application,
                       java.lang.String instance)
Same as register application, but returns an unregistered Endpoint. This allows the application to finish initialization that may require the endpoint before it receives messages from the network and notification of changes. When then application is ready, it must call endpoint.register() to receive messages.

Parameters:
application -
instance -
Returns:

printRouteState

java.lang.String printRouteState()
For debugging: print the internal routing state of the Node.

Returns:

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection