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.dist
Class DistCoalesedNodeHandle

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

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

public abstract class DistCoalesedNodeHandle
extends DistNodeHandle

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.

Version:
  $Id: DistCoalesedNodeHandle.java,v 1.6 2005/06/07 22:02:13 jeffh Exp $
Author:
  Alan Mislove
See Also:
  Serialized Form

Field Summary
`static int` | `DEFAULT_DISTANCE` DESCRIBE THE FIELD
`protected boolean` | `isInPool` DESCRIBE THE FIELD
`protected boolean` | `isLocal` DESCRIBE THE FIELD
`protected int` | `status` DESCRIBE THE FIELD

Fields inherited from class rice.pastry.dist.DistNodeHandle
`address, epoch, nodeId`

Fields inherited from class rice.pastry.NodeHandle
`LIVENESS_ALIVE, LIVENESS_DEAD, LIVENESS_SUSPECTED, localnode`

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

Constructor Summary
`DistCoalesedNodeHandle(NodeId nodeId, java.net.InetSocketAddress address)` Constructor

Method Summary
`void` | `addObserver(java.util.Observer o)` Adds a feature to the Observer attribute of the DistCoalesedNodeHandle object
`void` | `afterSetLocalNode()` Method called from LocalNode after localnode is set to non-null.
`protected void` | `clearChanged()` DESCRIBE THE METHOD
`int` | `countObservers()` DESCRIBE THE METHOD
`protected void` | `debug(java.lang.String s)` Prints out nicely formatted debug messages.
`void` | `deleteObserver(java.util.Observer o)` DESCRIBE THE METHOD
`void` | `deleteObservers()` DESCRIBE THE METHOD
`boolean` | `equals(java.lang.Object obj)` Equivalence relation for nodehandles.
`boolean` | `getIsInPool()` Returns whether or not this node handle is the one in the node handle pool.
`int` | `getLiveness()` Returns the last known liveness information about the Pastry node associated with this handle.
`boolean` | `hasChanged()` DESCRIBE THE METHOD
`int` | `hashCode()` Hash codes for node handles.
`void` | `markAlive()` Marks this handle as alive (if dead earlier), and reset distance to infinity.
`void` | `markDead()` Mark this handle as dead (if alive earlier), and reset distance to infinity.
`void` | `notifyObservers()` DESCRIBE THE METHOD
`void` | `notifyObservers(java.lang.Object arg)` DESCRIBE THE METHOD
`boolean` | `ping()` Ping the node.
`protected abstract boolean` | `pingImpl()` Ping the node.
`int` | `proximity()` Returns the last known proximity information about the Pastry node associated with this handle.
`protected abstract void` | `receiveMessageImpl(Message message)` Called to send a message to the node corresponding to this handle.
`protected void` | `setChanged()` Sets the Changed attribute of the DistCoalesedNodeHandle object
`void` | `setIsInPool(boolean iip)` Sets whether or not this node handle is in the node handle pool.
`protected void` | `setProximity(int value)` Method which is designed to be called by subclassses whenever there is a change in the distance metric.
`java.lang.String` | `toString()` Returns a String representation of this DistNodeHandle.
`protected abstract java.lang.String` | `toStringImpl()` 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
`getAddress, getEpoch, getNodeId`

Methods inherited from class rice.pastry.NodeHandle
`assertLocalNode, bootstrap, checkLiveness, getId, getLocalNode, isAlive, setLocalNode`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Methods inherited from interface rice.pastry.messaging.MessageReceiver
`receiveMessage`

Field Detail

### isInPool

    protected transient boolean isInPool

  DESCRIBE THE FIELD

### status

    protected transient int status

  DESCRIBE THE FIELD

### isLocal

    protected transient boolean isLocal

  DESCRIBE THE FIELD

### DEFAULT_DISTANCE

    public static int DEFAULT_DISTANCE

  DESCRIBE THE FIELD

Constructor Detail

### DistCoalesedNodeHandle

    public DistCoalesedNodeHandle(NodeId nodeId,
                                  java.net.InetSocketAddress address)

  Constructor

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

Method Detail

### getLiveness

    public final int getLiveness()

  Returns the last known liveness information about the Pastry node associated with this handle. Invoking this method does not cause network activity. 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:
    `getLiveness` in class `NodeHandle`
  Returns:
    true if the node is alive, false otherwise.

### getIsInPool

    public boolean getIsInPool()

  Returns whether or not this node handle is the one in the node handle pool.

  Returns:
    Whether or not this node handle is in the pool.

### setProximity

    protected final void setProximity(int value)

  Method which is designed to be called by subclassses whenever there is a change in the distance metric. This is done in order to abstract out the notification of the observers of a distance metric change.

  Parameters:
    `value` - The new distance value

### setIsInPool

    public void setIsInPool(boolean iip)

  Sets whether or not this node handle is in the node handle pool.

  Parameters:
    `iip` - Whether or not this node handle is in the node handle pool.

### setChanged

    protected void setChanged()

  Sets the Changed attribute of the DistCoalesedNodeHandle object

### afterSetLocalNode

    public void afterSetLocalNode()

  Method called from LocalNode after localnode is set to non-null. Updates the isLocal and alive variables.

  Overrides:
    `afterSetLocalNode` in class `NodeHandle`

### markAlive

    public final void markAlive()

  Marks this handle as alive (if dead earlier), and reset distance to infinity. If node is already marked as alive, this does nothing.

### markDead

    public final void markDead()

  Mark this handle as dead (if alive earlier), and reset distance to infinity. If node is already marked as deas, this method does nothing.

### proximity

    public final int proximity()

  Returns the last known proximity information about the Pastry node associated with this handle. Invoking this method does not cause network activity. 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. 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 final 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. 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:
    `ping` in class `NodeHandle`
  Returns:
    true if node is currently alive.

### pingImpl

    protected abstract boolean pingImpl()

  Ping the node. Refreshes the cached liveness status and proximity value of the Pastry node associated with this. Invoking this method causes network activity. This method is to be run by the node handle which is in the NodeHandlePool.

  Returns:
    true if node is currently alive.

### receiveMessageImpl

    protected abstract void receiveMessageImpl(Message message)

  Called to send a message to the node corresponding to this handle. This method is to be run by the node handle which is in the NodeHandlePool.

  Parameters:
    `message` - DESCRIBE THE PARAMETER

### toString

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

### toStringImpl

    protected abstract java.lang.String toStringImpl()

  Returns a String representation of this DistNodeHandle. This method is to be run by the node handle which is in the NodeHandlePool.

  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.

### debug

    protected void debug(java.lang.String s)

  Prints out nicely formatted debug messages.

  Parameters:
    `s` - The message to print.

### addObserver

    public void addObserver(java.util.Observer o)

  Adds a feature to the Observer attribute of the DistCoalesedNodeHandle object

  Parameters:
    `o` - The feature to be added to the Observer attribute

### countObservers

    public int countObservers()

  DESCRIBE THE METHOD

  Returns:
    DESCRIBE THE RETURN VALUE

### deleteObserver

    public void deleteObserver(java.util.Observer o)

  DESCRIBE THE METHOD

  Parameters:
    `o` - DESCRIBE THE PARAMETER

### deleteObservers

    public void deleteObservers()

  DESCRIBE THE METHOD

### hasChanged

    public boolean hasChanged()

  DESCRIBE THE METHOD

  Returns:
    DESCRIBE THE RETURN VALUE

### notifyObservers

    public void notifyObservers()

  DESCRIBE THE METHOD

### notifyObservers

    public void notifyObservers(java.lang.Object arg)

  DESCRIBE THE METHOD

  Parameters:
    `arg` - DESCRIBE THE PARAMETER

### clearChanged

    protected void clearChanged()

  DESCRIBE THE METHOD

### update

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

  DESCRIBE THE METHOD

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

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.