Rice Pastry API

rice.pastry.rmi
Class RMINodeHandle

java.lang.Object
  |
  +--java.util.Observable
        |
        +--rice.p2p.commonapi.NodeHandle
              |
              +--rice.pastry.NodeHandle
                    |
                    +--rice.pastry.dist.DistNodeHandle
                          |
                          +--rice.pastry.rmi.RMINodeHandle
All Implemented Interfaces:
LocalNodeI, MessageReceiver, java.util.Observer, java.io.Serializable

public class RMINodeHandle
extends DistNodeHandle

A locally stored node handle that points to a remote RMIRemoteNodeI. Need localnode within handle for three reasons: to determine isLocal (thus alive and proximity() = 0), to set senderId in messages (used for coalescing on the other end), and to bounce messages back to self on failure.

Version:
$Id: RMINodeHandle.java,v 1.40 2003/06/29 08:40:08 druschel Exp $
Author:
Sitaram Iyer, Peter Druschel
See Also:
Serialized Form

Field Summary
 int id
           
static int index
           
 
Fields inherited from class rice.pastry.dist.DistNodeHandle
address, alive, DEFAULT_DISTANCE, isInPool, isLocal, nodeId
 
Fields inherited from class rice.pastry.NodeHandle
localnode
 
Fields inherited from class rice.p2p.commonapi.NodeHandle
DECLARED_DEAD, DECLARED_LIVE, PROXIMITY_CHANGED
 
Fields inherited from interface rice.pastry.LocalNodeI
pending
 
Constructor Summary
RMINodeHandle(rice.pastry.rmi.RMIRemoteNodeI rn, rice.pastry.NodeId nid, java.net.InetSocketAddress address)
          Constructor.
RMINodeHandle(rice.pastry.rmi.RMIRemoteNodeI rn, rice.pastry.NodeId nid, rice.pastry.PastryNode pn, java.net.InetSocketAddress address)
          Alternate constructor with local Pastry node.
 
Method Summary
 void doPing()
          Do the (blocking) ping
 void doSend(rice.pastry.messaging.Message msg)
          Do the actual (blocking) RMI call to the remote node
 rice.pastry.rmi.RMIRemoteNodeI getRemote()
          Remotenode accessor method.
 boolean pingImpl()
          Ping the remote node now, and update the proximity metric.
 void receiveMessageImpl(rice.pastry.messaging.Message msg)
          Called to send a message to the node corresponding to this handle.
 void setRemoteNode(rice.pastry.rmi.RMIRemoteNodeI rn)
          Remotenode accessor method.
 java.lang.String toStringImpl()
          Returns a String representation of this DistNodeHandle.
 
Methods inherited from class rice.pastry.dist.DistNodeHandle
addObserver, afterSetLocalNode, clearChanged, countObservers, debug, deleteObserver, deleteObservers, equals, getAddress, getIsInPool, getNodeId, hasChanged, hashCode, isAlive, markAlive, markDead, notifyObservers, notifyObservers, ping, proximity, receiveMessage, setChanged, setIsInPool, setProximity, toString, update
 
Methods inherited from class rice.pastry.NodeHandle
assertLocalNode, getId, getLocalNode, setLocalNode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

index

public static transient int index

id

public transient int id
Constructor Detail

RMINodeHandle

public RMINodeHandle(rice.pastry.rmi.RMIRemoteNodeI rn,
                     rice.pastry.NodeId nid,
                     java.net.InetSocketAddress address)
Constructor. rn could be the local node, in which case this elegantly folds in the terrible ProxyNodeHandle stuff (since the RMI node acts as a proxy).

Parameters:
rn - pastry node for whom we're constructing a handle.
nid - its node id.

RMINodeHandle

public RMINodeHandle(rice.pastry.rmi.RMIRemoteNodeI rn,
                     rice.pastry.NodeId nid,
                     rice.pastry.PastryNode pn,
                     java.net.InetSocketAddress address)
Alternate constructor with local Pastry node.

Parameters:
rn - pastry node for whom we're constructing a handle.
nid - its node id.
pn - local Pastry node.
Method Detail

getRemote

public rice.pastry.rmi.RMIRemoteNodeI getRemote()
Remotenode accessor method. Same as redirect.getRemote().

Returns:
RMI remote reference to Pastry node.

setRemoteNode

public void setRemoteNode(rice.pastry.rmi.RMIRemoteNodeI rn)
Remotenode accessor method.

Parameters:
rn - RMI remote reference to some Pastry node.

receiveMessageImpl

public void receiveMessageImpl(rice.pastry.messaging.Message msg)
Called to send a message to the node corresponding to this handle.

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

doSend

public void doSend(rice.pastry.messaging.Message msg)
Do the actual (blocking) RMI call to the remote node

Parameters:
msg - Message to be delivered, may or may not be routeMessage.

pingImpl

public boolean pingImpl()
Ping the remote node now, and update the proximity metric.

Specified by:
pingImpl in class DistNodeHandle
Returns:
liveness of remote node.

doPing

public void doPing()
Do the (blocking) ping


toStringImpl

public java.lang.String toStringImpl()
Description copied from class: DistNodeHandle
Returns a String representation of this DistNodeHandle. This method is to be run by the node handle which is in the NodeHandlePool.

Specified by:
toStringImpl in class DistNodeHandle
Returns:
A String representation of the node handle.

Rice Pastry API

Copyright © 2001 - Rice Pastry.


Imprint-Dataprotection