Rice Pastry API

rice.pastry
Class NodeHandle

java.lang.Object
  |
  +--java.util.Observable
        |
        +--rice.p2p.commonapi.NodeHandle
              |
              +--rice.pastry.NodeHandle
All Implemented Interfaces:
LocalNodeI, MessageReceiver, java.io.Serializable
Direct Known Subclasses:
DirectNodeHandle, DistNodeHandle, LeafSetTest.TestNodeHandle

public abstract class NodeHandle
extends NodeHandle
implements MessageReceiver, LocalNodeI

Interface for handles to remote nodes.

Version:
$Id: NodeHandle.java,v 1.15 2003/09/24 02:20:39 amislove Exp $
Author:
Andrew Ladd
See Also:
Serialized Form

Field Summary
protected  rice.pastry.PastryNode localnode
           
 
Fields inherited from class rice.p2p.commonapi.NodeHandle
DECLARED_DEAD, DECLARED_LIVE, PROXIMITY_CHANGED
 
Fields inherited from interface rice.pastry.LocalNodeI
pending
 
Constructor Summary
NodeHandle()
           
 
Method Summary
 void afterSetLocalNode()
          Method that can be overridden by handle to set isLocal, etc.
 void assertLocalNode()
          May be called from handle etc methods to ensure that local node has been set, either on construction or on deserialization/receivemsg.
abstract  boolean equals(java.lang.Object obj)
          Equality operator for nodehandles.
 rice.p2p.commonapi.Id getId()
          Returns this node's id.
 rice.pastry.PastryNode getLocalNode()
          Accessor method.
abstract  rice.pastry.NodeId getNodeId()
          Gets the nodeId of this Pastry node.
abstract  int hashCode()
          Hash codes for nodehandles.
abstract  boolean isAlive()
          Returns the last known liveness information about the Pastry node associated with this handle.
abstract  boolean ping()
          Ping the node.
abstract  int proximity()
          Returns the last known proximity information about the Pastry node associated with this handle.
 void setLocalNode(rice.pastry.PastryNode pn)
          Set the local PastryNode.
 
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
 
Methods inherited from interface rice.pastry.messaging.MessageReceiver
receiveMessage
 

Field Detail

localnode

protected transient rice.pastry.PastryNode localnode
Constructor Detail

NodeHandle

public NodeHandle()
Method Detail

getNodeId

public abstract rice.pastry.NodeId getNodeId()
Gets the nodeId of this Pastry node.

Returns:
the node id.

getId

public rice.p2p.commonapi.Id getId()
Description copied from class: NodeHandle
Returns this node's id.

Specified by:
getId in class NodeHandle
Returns:
The corresponding node's id.

isAlive

public abstract boolean isAlive()
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.

proximity

public abstract int proximity()
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

ping

public abstract boolean ping()
Ping the node. Refreshes the cached liveness status and proximity value of the Pastry node associated with this. Invoking this method causes network activity.

Returns:
true if node is currently alive.

setLocalNode

public final void setLocalNode(rice.pastry.PastryNode pn)
Set the local PastryNode.

Specified by:
setLocalNode in interface LocalNodeI
Parameters:
pn - local pastrynode

afterSetLocalNode

public void afterSetLocalNode()
Method that can be overridden by handle to set isLocal, etc.


getLocalNode

public final rice.pastry.PastryNode getLocalNode()
Accessor method.

Specified by:
getLocalNode in interface LocalNodeI

assertLocalNode

public final void assertLocalNode()
May be called from handle etc methods to ensure that local node has been set, either on construction or on deserialization/receivemsg.

Specified by:
assertLocalNode in interface LocalNodeI

equals

public abstract boolean equals(java.lang.Object obj)
Equality operator for nodehandles.

Overrides:
equals in class java.lang.Object
Parameters:
obj - a nodehandle object
Returns:
true if they are equal, false otherwise.

hashCode

public abstract int hashCode()
Hash codes for nodehandles.

Overrides:
hashCode in class java.lang.Object
Returns:
a hash code.

Rice Pastry API

Copyright © 2001 - Rice Pastry.


Imprint-Dataprotection