Rice Pastry API

rice.pastry.socket
Class SocketNodeHandle

java.lang.Object
  extended by java.util.Observable
      extended by rice.p2p.commonapi.NodeHandle
          extended by rice.pastry.NodeHandle
              extended by rice.pastry.socket.TransportLayerNodeHandle<Identifier>
                  extended by rice.pastry.dist.DistNodeHandle<MultiInetSocketAddress>
                      extended by rice.pastry.socket.SocketNodeHandle
All Implemented Interfaces:
java.io.Serializable, java.util.Observer, RawSerializable
Direct Known Subclasses:
RendezvousSocketNodeHandle

public class SocketNodeHandle
extends DistNodeHandle<MultiInetSocketAddress>

See Also:
Serialized Form

Field Summary
 MultiInetSocketAddress eaddress
           
protected  long epoch
           
 
Fields inherited from class rice.pastry.dist.DistNodeHandle
nodeId
 
Fields inherited from class rice.pastry.NodeHandle
LIVENESS_ALIVE, LIVENESS_DEAD, LIVENESS_SUSPECTED, localnode, logger
 
Fields inherited from class rice.p2p.commonapi.NodeHandle
DECLARED_DEAD, DECLARED_LIVE, PROXIMITY_CHANGED
 
Constructor Summary
protected SocketNodeHandle(MultiInetSocketAddress eisa, long epoch, Id id, PastryNode node)
           
 
Method Summary
 boolean checkLiveness()
          Method which FORCES a check of liveness of the remote node.
 boolean equals(java.lang.Object obj)
          Equivalence relation for nodehandles.
 MultiInetSocketAddress getAddress()
          Returns the InetSocketAddress that should be used to contact the node
 long getEpoch()
           
 MultiInetSocketAddress getIdentifier()
           
 java.net.InetSocketAddress getInetSocketAddress()
           
 int getLiveness()
          Returns the last known liveness information about the Pastry node associated with this handle.
 int hashCode()
          Hash codes for node handles.
 boolean isLocal()
          Method which returns whether or not this node handle is on its home node.
 boolean ping()
          Ping the node.
 int proximity()
          Deprecated. use PastryNode.proximity(nh)
 void receiveMessage(Message msg)
          Deprecated. use PastryNode.send(msg, nh)
 void serialize(OutputBuffer buf)
           
 void setLocalNode(PastryNode pn)
           
 java.lang.String toString()
          Returns a String representation of this DistNodeHandle.
 java.lang.String toStringFull()
           
 void update(java.util.Observable o, java.lang.Object obj)
          DESCRIBE THE METHOD
 
Methods inherited from class rice.pastry.dist.DistNodeHandle
getNodeId
 
Methods inherited from class rice.pastry.NodeHandle
addObserver, addObserver, assertLocalNode, bootstrap, countObservers, deleteObserver, deleteObservers, getId, getLocalNode, isAlive, notifyObservers, update
 
Methods inherited from class java.util.Observable
clearChanged, hasChanged, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

eaddress

public MultiInetSocketAddress eaddress

epoch

protected long epoch
Constructor Detail

SocketNodeHandle

protected SocketNodeHandle(MultiInetSocketAddress eisa,
                           long epoch,
                           Id id,
                           PastryNode node)
Method Detail

getEpoch

public long getEpoch()
Specified by:
getEpoch in class TransportLayerNodeHandle<MultiInetSocketAddress>

setLocalNode

public void setLocalNode(PastryNode pn)

getIdentifier

public MultiInetSocketAddress getIdentifier()

getLiveness

public int getLiveness()
Returns the last known liveness information about the Pastry node associated with this handle. Invoking this method does not cause network activity.

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

getAddress

public MultiInetSocketAddress getAddress()
Returns the InetSocketAddress that should be used to contact the node

Specified by:
getAddress in class TransportLayerNodeHandle<MultiInetSocketAddress>
Parameters:
addressList - The sorted list of address alieses. From Internet to LAN
Returns:

getInetSocketAddress

public java.net.InetSocketAddress getInetSocketAddress()
Specified by:
getInetSocketAddress in class DistNodeHandle<MultiInetSocketAddress>

checkLiveness

public boolean checkLiveness()
Method which FORCES a check of liveness of the remote node. Note that this method should ONLY be called by internal Pastry maintenance algorithms - this is NOT to be used by applications. Doing so will likely cause a blowup of liveness traffic.

Overrides:
checkLiveness in class NodeHandle
Returns:
true if node is currently alive.

isLocal

public boolean isLocal()
Method which returns whether or not this node handle is on its home node.

Returns:
Whether or not this handle is local

receiveMessage

public void receiveMessage(Message msg)
Deprecated. use PastryNode.send(msg, nh)

Called to send a message to the node corresponding to this handle.

Specified by:
receiveMessage in class NodeHandle
Parameters:
msg - Message to be delivered, may or may not be routeMessage.

toString

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

Specified by:
toString in class DistNodeHandle<MultiInetSocketAddress>
Returns:
A String representation of the node handle.

toStringFull

public java.lang.String toStringFull()

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 DistNodeHandle<MultiInetSocketAddress>
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 DistNodeHandle<MultiInetSocketAddress>
Returns:
a hash code.

proximity

public int proximity()
Deprecated. use PastryNode.proximity(nh)

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

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

update

public void update(java.util.Observable o,
                   java.lang.Object obj)
DESCRIBE THE METHOD

Parameters:
o - DESCRIBE THE PARAMETER
obj - DESCRIBE THE PARAMETER

serialize

public void serialize(OutputBuffer buf)
               throws java.io.IOException
Specified by:
serialize in interface RawSerializable
Specified by:
serialize in class NodeHandle
Throws:
java.io.IOException

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection