rice.pastry.dist
Class DistNodeHandle

java.lang.Object
  extended byjava.util.Observable
      extended byrice.p2p.commonapi.NodeHandle
          extended byrice.pastry.NodeHandle
              extended byrice.pastry.dist.DistNodeHandle
All Implemented Interfaces:
LocalNodeI, MessageReceiver, java.util.Observer, java.io.Serializable
Direct Known Subclasses:
DistCoalesedNodeHandle

public abstract class DistNodeHandle
extends NodeHandle
implements java.util.Observer

Abstract class for handles to "real" remote nodes. This class abstracts out the node handle verification which is necessary in the "real" pastry protocols, since NodeHandles are sent across the wire.

See Also:
Serialized Form

Field Summary
protected  java.net.InetSocketAddress address
           
protected  NodeId nodeId
           
 
Fields inherited from class rice.pastry.NodeHandle
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
DistNodeHandle(NodeId nodeId, java.net.InetSocketAddress address)
          Constructor
 
Method Summary
abstract  boolean equals(java.lang.Object obj)
          Equivalence relation for nodehandles.
 java.net.InetSocketAddress getAddress()
          Returns the IP address and port of the remote node.
 NodeId getNodeId()
          Gets the nodeId of this Pastry node.
abstract  int hashCode()
          Hash codes for node handles.
abstract  java.lang.String toString()
          Returns a String representation of this DistNodeHandle.
 
Methods inherited from class rice.pastry.NodeHandle
afterSetLocalNode, assertLocalNode, getId, getLocalNode, isAlive, ping, proximity, 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, wait, wait, wait
 
Methods inherited from interface java.util.Observer
update
 
Methods inherited from interface rice.pastry.messaging.MessageReceiver
receiveMessage
 

Field Detail

nodeId

protected NodeId nodeId

address

protected java.net.InetSocketAddress address
Constructor Detail

DistNodeHandle

public DistNodeHandle(NodeId nodeId,
                      java.net.InetSocketAddress address)
Constructor

Parameters:
nodeId - This node handle's node Id.
Method Detail

getNodeId

public final NodeId getNodeId()
Gets the nodeId of this Pastry node.

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

getAddress

public final java.net.InetSocketAddress getAddress()
Returns the IP address and port of the remote node.

Returns:
The InetSocketAddress of the remote node.

toString

public abstract java.lang.String toString()
Returns a String representation of this DistNodeHandle. This method is designed to be called by clients using the node handle, and is provided in order to ensure that the right node handle is being talked to.

Returns:
A String representation of the node handle.

equals

public abstract 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 abstract 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.





Imprint-Dataprotection