Rice Pastry API

rice.pastry.direct
Class DirectNodeHandle

java.lang.Object
  |
  +--java.util.Observable
        |
        +--rice.pastry.NodeHandle
              |
              +--rice.pastry.direct.DirectNodeHandle
All Implemented Interfaces:
LocalNodeI, MessageReceiver, NodeHandle, java.io.Serializable

public class DirectNodeHandle
extends NodeHandle

the node handle used with the direct network

Version:
$Id: DirectNodeHandle.java,v 1.11 2002/09/01 07:37:16 druschel Exp $
Author:
Andrew Ladd, Rongmei Zhang/Y. Charlie Hu
See Also:
Serialized Form

Field Summary
 
Fields inherited from class rice.pastry.NodeHandle
DECLARED_DEAD, DECLARED_LIVE, PROXIMITY_CHANGED
 
Fields inherited from interface rice.pastry.LocalNodeI
pending
 
Constructor Summary
DirectNodeHandle(PastryNode ln, PastryNode rn, NetworkSimulator sim)
           
 
Method Summary
 boolean equals(java.lang.Object obj)
          Equivalence relation for nodehandles.
 NodeId getNodeId()
          Gets the nodeId of this Pastry node.
 PastryNode getRemote()
           
 NetworkSimulator getSimulator()
           
 int hashCode()
          Hash codes for node handles.It is the hashcode of their corresponding NodeId's.
 boolean isAlive()
          Returns the last known liveness information about the Pastry node associated with this handle.
 boolean ping()
          Ping the node.
 int proximity()
          Returns the last known proximity information about the Pastry node associated with this handle.
 void receiveMessage(Message msg)
          Passes a message along to entity which is this message receiver.
 
Methods inherited from class rice.pastry.NodeHandle
afterSetLocalNode, assertLocalNode, getId, getLocalNode, setLocalNode
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DirectNodeHandle

public DirectNodeHandle(PastryNode ln,
                        PastryNode rn,
                        NetworkSimulator sim)
Method Detail

getRemote

public PastryNode getRemote()

getNodeId

public NodeId getNodeId()
Description copied from class: NodeHandle
Gets the nodeId of this Pastry node.

Specified by:
getNodeId in class NodeHandle
Returns:
the node id.

isAlive

public boolean isAlive()
Description copied from class: NodeHandle
Returns the last known liveness information about the Pastry node associated with this handle. Invoking this method does not cause network activity.

Specified by:
isAlive in class NodeHandle
Returns:
true if the node is alive, false otherwise.

ping

public boolean ping()
Description copied from class: NodeHandle
Ping the node. Refreshes the cached liveness status and proximity value of the Pastry node associated with this. Invoking this method causes network activity.

Specified by:
ping in class NodeHandle
Returns:
true if node is currently alive.

proximity

public int proximity()
Description copied from class: NodeHandle
Returns the last known proximity information about the Pastry node associated with this handle. Invoking this method does not cause network activity. Smaller values imply greater proximity. The exact nature and interpretation of the proximity metric implementation-specific.

Specified by:
proximity in class NodeHandle
Returns:
the proximity metric value

receiveMessage

public void receiveMessage(Message msg)
Description copied from interface: MessageReceiver
Passes a message along to entity which is this message receiver.

Parameters:
msg - the message.

getSimulator

public NetworkSimulator getSimulator()

equals

public boolean equals(java.lang.Object obj)
Equivalence relation for nodehandles. They are equal if and only if their corresponding NodeIds are equal.

Specified by:
equals in class NodeHandle
Parameters:
obj - the other nodehandle .
Returns:
true if they are equal, false otherwise.

hashCode

public int hashCode()
Hash codes for node handles.It is the hashcode of their corresponding NodeId's.

Specified by:
hashCode in class NodeHandle
Returns:
a hash code.

Rice Pastry API

Copyright © 2001 - Rice Pastry