rice.p2p.commonapi
Interface Node
- All Known Implementing Classes:
- GCNode, MultiringNode, PastryNode
- public interface Node
- Version:
- $Id: Node.java,v 1.11 2005/04/08 03:24:06 amislove Exp $
- Author:
- Alan Mislove, Peter Druschel
Method Summary |
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. |
Endpoint |
registerApplication(Application application,
int port)
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. |
Endpoint |
registerApplication(Application application,
java.lang.String instance)
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. |
registerApplication
public Endpoint registerApplication(Application application,
java.lang.String instance)
- 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 Applicationinstance
- An identifier for a given instance
- Returns:
- The endpoint specific to this applicationk, which can be used for
message sending/receiving.
registerApplication
public Endpoint registerApplication(Application application,
int port)
- 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 allows advanced developers to specify which
"port" on the node they wish their application to register as. This "port"
determines which of the applications on top of the node should receive an
incoming message. NOTE: Use of this method of registering applications is
recommended only for advanced users - 99% of all applications should just
use the other registerApplication
- Parameters:
application
- The Applicationport
- The port to use
- Returns:
- The endpoint specific to this applicationk, which can be used for
message sending/receiving.
getId
public Id getId()
- Returns the Id of this node
- Returns:
- This node's Id
getIdFactory
public IdFactory getIdFactory()
- Returns a factory for Ids specific to this node's protocol.
- Returns:
- A factory for creating Ids.
getLocalNodeHandle
public 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.
Copyright © 2001-2005 - Rice Pastry.