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
Class NodeHandle

    java.lang.Object
      java.util.Observable
          rice.p2p.commonapi.NodeHandle
              rice.pastry.NodeHandle

All Implemented Interfaces:
  java.io.Serializable

Direct Known Subclasses:
  DirectNodeHandle, DistNodeHandle, LeafSetTest.TestNodeHandle, MergeTest.TestNodeHandle

    public abstract class NodeHandle

extends NodeHandle

Interface for handles to remote nodes.

Version:
  $Id: NodeHandle.java 3519 2007-01-08 17:57:39Z jeffh $
Author:
  Andrew Ladd
See Also:
  Serialized Form

Field Summary
`static int` | `LIVENESS_ALIVE`
`static int` | `LIVENESS_DEAD`
`static int` | `LIVENESS_SUSPECTED`
`protected PastryNode` | `localnode`
`protected Logger` | `logger`

Fields inherited from class rice.p2p.commonapi.NodeHandle
`DECLARED_DEAD, DECLARED_LIVE, PROXIMITY_CHANGED`

Constructor Summary
`NodeHandle()`

Method Summary
`void` | `assertLocalNode()` May be called from handle etc methods to ensure that local node has been set, either on construction or on deserialization/receivemsg.
`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.
`abstract boolean` | `equals(java.lang.Object obj)` Equality operator for nodehandles.
`Id` | `getId()` Returns this node's id.
`abstract int` | `getLiveness()` A more detailed version of isAlive().
`PastryNode` | `getLocalNode()` Accessor method.
`abstract Id` | `getNodeId()` Gets the nodeId of this Pastry node.
`abstract int` | `hashCode()` Hash codes for nodehandles.
`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()` Deprecated. use PastryNode.proximity() or Endpoint.proximity()
`abstract void` | `receiveMessage(Message msg)` Deprecated. use PastryNode.send() or Endpoint.send()
`abstract void` | `serialize(OutputBuffer buf)`

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`

Field Detail

### LIVENESS_ALIVE

    public static final int LIVENESS_ALIVE

See Also:
  Constant Field Values

### LIVENESS_SUSPECTED

    public static final int LIVENESS_SUSPECTED

See Also:
  Constant Field Values

### LIVENESS_DEAD

    public static final int LIVENESS_DEAD

See Also:
  Constant Field Values

### localnode

    protected transient PastryNode localnode

### logger

    protected transient Logger logger

Constructor Detail

### NodeHandle

    public NodeHandle()

Method Detail

### getNodeId

    public abstract Id getNodeId()

  Gets the nodeId of this Pastry node.

  Returns:
    the node id.

### getId

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

### getLiveness

    public abstract int getLiveness()

  A more detailed version of isAlive(). This can return 3 states:

  Returns:
    LIVENESS_ALIVE, LIVENESS_SUSPECTED, LIVENESS_DEAD

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

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

### proximity

    public abstract int proximity()

  Deprecated. use PastryNode.proximity() or Endpoint.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.

### getLocalNode

    public final PastryNode getLocalNode()

  Accessor method.

### assertLocalNode

    public void assertLocalNode()

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

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

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

  Parameters:
    `msg` - the bootstrap message.
  Throws:
    `java.io.IOException`

### hashCode

    public abstract int hashCode()

  Hash codes for nodehandles.

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

### receiveMessage

    public abstract void receiveMessage(Message msg)

  Deprecated. use PastryNode.send() or Endpoint.send()

  Parameters:
    `msg` -

### serialize

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