Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Rice Pastry API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## rice.pastry.socket
Class SocketNodeHandle

    java.lang.Object
      java.util.Observable
          rice.p2p.commonapi.NodeHandle
              rice.pastry.NodeHandle
                  rice.pastry.dist.DistNodeHandle
                      rice.pastry.socket.SocketNodeHandle

All Implemented Interfaces:
  java.io.Serializable, java.util.Observer

    public class SocketNodeHandle

extends DistNodeHandle

Class which represents the address and nodeId of a remote node. In the socket protocol, it simply represents this information - all other details are managed by the local nodes. SocketNodeHandle can now internally exist without a NodeId. This is to get the memory management correct

Version:
  $Id: SocketNodeHandle.java 3613 2007-02-15 14:45:14Z jstewart $
Author:
  Alan Mislove
See Also:
  Serialized Form

Field Summary
`static int` | `DEFAULT_PROXIMITY`
`protected EpochInetSocketAddress` | `eaddress`
`static int` | `LIVENESS_DEAD_FOREVER`

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
`SocketNodeHandle(EpochInetSocketAddress address, Id nodeId)` Constructor

Method Summary
`void` | `bootstrap(Message msg)` Method which is used by Pastry to start the bootstrapping process on the local node using this handle as the bootstrap handle.
`boolean` | `checkLiveness()` Method which FORCES a check of liveness of the remote node.
`boolean` | `equals(java.lang.Object obj)` Equivalence relation for nodehandles.
`java.net.InetSocketAddress` | `getAddress()`
`java.net.InetSocketAddress` | `getAddress(java.net.InetAddress[] addressList)` Returns the InetSocketAddress that should be used to contact the node
`EpochInetSocketAddress` | `getEpochAddress()`
`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.
`void` | `markDeadForever()` You can call this method if the node shuts down nicely.
`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(SocketPastryNode spn)`
`void` | `setNodeId(Id nodeId)` Serialization
`java.lang.String` | `toString()` Returns a String representation of this DistNodeHandle.
`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, 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

### LIVENESS_DEAD_FOREVER

    public static final int LIVENESS_DEAD_FOREVER

See Also:
  Constant Field Values

### DEFAULT_PROXIMITY

    public static final int DEFAULT_PROXIMITY

See Also:
  Constant Field Values

### eaddress

    protected EpochInetSocketAddress eaddress

Constructor Detail

### SocketNodeHandle

    public SocketNodeHandle(EpochInetSocketAddress address,
                            Id nodeId)

  Constructor

  Parameters:
    `nodeId` - This node handle's node Id.
    `address` - DESCRIBE THE PARAMETER

Method Detail

### getEpochAddress

    public EpochInetSocketAddress getEpochAddress()

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

### markDeadForever

    public void markDeadForever()

  You can call this method if the node shuts down nicely. This will cause it to be removed from the leafset. Improves the performance of consistency.

### getAddress

    public java.net.InetSocketAddress getAddress(java.net.InetAddress[] addressList)

  Returns the InetSocketAddress that should be used to contact the node

  Parameters:
    `addressList` - The sorted list of address alieses. From Internet to LAN
  Returns:

### getAddress

    public java.net.InetSocketAddress getAddress()

  Specified by:
    `getAddress` in class `DistNodeHandle`

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

### bootstrap

    public void bootstrap(Message msg)
                   throws java.io.IOException

  Method which is used by Pastry to start the bootstrapping process on the local node using this handle as the bootstrap handle. Default behavior is simply to call receiveMessage(msg), but transport layer implementations may care to perform other tasks by overriding this method, since the node is not technically part of the ring yet.

  Overrides:
    `bootstrap` in class `NodeHandle`
  Parameters:
    `msg` - the bootstrap message.
  Throws:
    `java.io.IOException`

### 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`
  Returns:
    A String representation of the node handle.

### 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`
  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`
  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

### setNodeId

    public void setNodeId(Id nodeId)

  Serialization

### setLocalNode

    public void setLocalNode(SocketPastryNode spn)

### serialize

    public void serialize(OutputBuffer buf)
                   throws java.io.IOException

  Specified by:
    `serialize` in class `NodeHandle`
  Throws:
    `java.io.IOException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Rice Pastry API
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2005 - Rice Pastry.