|
Rice Pastry API | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.util.Observable | +--rice.p2p.commonapi.NodeHandle | +--rice.pastry.NodeHandle | +--rice.pastry.dist.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.
Field Summary | |
protected java.net.InetSocketAddress |
address
|
protected boolean |
alive
|
static int |
DEFAULT_DISTANCE
|
protected boolean |
isInPool
|
protected boolean |
isLocal
|
protected rice.pastry.NodeId |
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 | |
DistNodeHandle(rice.pastry.NodeId nodeId,
java.net.InetSocketAddress address)
Constructor |
Method Summary | |
void |
addObserver(java.util.Observer o)
|
void |
afterSetLocalNode()
Method called from LocalNode after localnode is set to non-null. |
protected void |
clearChanged()
|
int |
countObservers()
|
protected void |
debug(java.lang.String s)
Prints out nicely formatted debug messages. |
void |
deleteObserver(java.util.Observer o)
|
void |
deleteObservers()
|
boolean |
equals(java.lang.Object obj)
Equivalence relation for nodehandles. |
java.net.InetSocketAddress |
getAddress()
Returns the IP address and port of the remote node. |
boolean |
getIsInPool()
Returns whether or not this node handle is the one in the node handle pool. |
rice.pastry.NodeId |
getNodeId()
Gets the nodeId of this Pastry node. |
boolean |
hasChanged()
|
int |
hashCode()
Hash codes for node handles. |
boolean |
isAlive()
Returns the last known liveness information about the Pastry node associated with this handle. |
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()
|
void |
notifyObservers(java.lang.Object arg)
|
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. |
void |
receiveMessage(rice.pastry.messaging.Message message)
Called to send a message to the node corresponding to this handle. |
protected abstract void |
receiveMessageImpl(rice.pastry.messaging.Message message)
Called to send a message to the node corresponding to this handle. |
protected void |
setChanged()
|
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)
|
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 |
public static int DEFAULT_DISTANCE
protected rice.pastry.NodeId nodeId
protected java.net.InetSocketAddress address
protected transient boolean isInPool
protected transient boolean alive
protected transient boolean isLocal
Constructor Detail |
public DistNodeHandle(rice.pastry.NodeId nodeId, java.net.InetSocketAddress address)
nodeId
- This node handle's node Id.Method Detail |
public final rice.pastry.NodeId getNodeId()
getNodeId
in class NodeHandle
public void afterSetLocalNode()
afterSetLocalNode
in class NodeHandle
public final boolean isAlive()
isAlive
in class NodeHandle
public final void markAlive()
public final void markDead()
public final int proximity()
proximity
in class NodeHandle
protected final void setProximity(int value)
value
- The new distance valuepublic final boolean ping()
ping
in class NodeHandle
protected abstract boolean pingImpl()
public java.net.InetSocketAddress getAddress()
public final void receiveMessage(rice.pastry.messaging.Message message)
receiveMessage
in interface MessageReceiver
message
- the message.protected abstract void receiveMessageImpl(rice.pastry.messaging.Message message)
public final java.lang.String toString()
toString
in class java.lang.Object
protected abstract java.lang.String toStringImpl()
public boolean getIsInPool()
public void setIsInPool(boolean iip)
iip
- Whether or not this node handle is in the node handle pool.public boolean equals(java.lang.Object obj)
equals
in class NodeHandle
obj
- the other nodehandle .
public int hashCode()
hashCode
in class NodeHandle
protected void debug(java.lang.String s)
s
- The message to print.public void addObserver(java.util.Observer o)
addObserver
in class java.util.Observable
public int countObservers()
countObservers
in class java.util.Observable
public void deleteObserver(java.util.Observer o)
deleteObserver
in class java.util.Observable
public void deleteObservers()
deleteObservers
in class java.util.Observable
public boolean hasChanged()
hasChanged
in class java.util.Observable
public void notifyObservers()
notifyObservers
in class java.util.Observable
public void notifyObservers(java.lang.Object arg)
notifyObservers
in class java.util.Observable
protected void setChanged()
setChanged
in class java.util.Observable
protected void clearChanged()
clearChanged
in class java.util.Observable
public void update(java.util.Observable o, java.lang.Object obj)
update
in interface java.util.Observer
|
Rice Pastry API | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |