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:
  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.24 2005/03/11 00:58:11 jeffh Exp $
Author:
  Andrew Ladd
See Also:
  Serialized Form

Field Summary
`static int` | `LIVENESS_ALIVE` DESCRIBE THE FIELD
`static int` | `LIVENESS_DEAD` DESCRIBE THE FIELD
`static int` | `LIVENESS_SUSPECTED` DESCRIBE THE FIELD
`protected PastryNode` | `localnode` DESCRIBE THE FIELD

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.
`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()` Gets the Id attribute of the NodeHandle object
`abstract int` | `getLiveness()` A more detailed version of isAlive().
`PastryNode` | `getLocalNode()` Accessor method.
`abstract NodeId` | `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()` Returns the last known proximity information about the Pastry node associated with this handle.
`void` | `setLocalNode(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 PastryNode localnode

  DESCRIBE THE FIELD

### LIVENESS_ALIVE

    public static final int LIVENESS_ALIVE

  DESCRIBE THE FIELD

  See Also:
    Constant Field Values

### LIVENESS_SUSPECTED

    public static final int LIVENESS_SUSPECTED

  DESCRIBE THE FIELD

  See Also:
    Constant Field Values

### LIVENESS_DEAD

    public static final int LIVENESS_DEAD

  DESCRIBE THE FIELD

  See Also:
    Constant Field Values

Constructor Detail

### NodeHandle

    public NodeHandle()

Method Detail

### getNodeId

    public abstract NodeId getNodeId()

  Gets the nodeId of this Pastry node.

  Returns:
    the node id.

### getId

    public Id getId()

  Gets the Id attribute of the NodeHandle object

  Specified by:
    `getId` in class `NodeHandle`
  Returns:
    The Id value

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

### getLocalNode

    public final PastryNode getLocalNode()

  Accessor method.

  Specified by:
    `getLocalNode` in interface `LocalNodeI`
  Returns:
    The LocalNode value

### setLocalNode

    public final void setLocalNode(PastryNode pn)

  Set the local PastryNode.

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

### 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()

  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.

### afterSetLocalNode

    public void afterSetLocalNode()

  Method that can be overridden by handle to set isLocal, etc.

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

  Parameters:
    `obj` - a nodehandle object
  Returns:
    true if they are equal, false otherwise.

### bootstrap

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

### hashCode

    public abstract int hashCode()

  Hash codes for nodehandles.

  Returns:
    a hash code.

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.