|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.Observable
rice.p2p.commonapi.NodeHandle
rice.pastry.NodeHandle
rice.pastry.dist.DistNodeHandle
rice.pastry.dist.DistCoalesedNodeHandle
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 boolean |
alive
|
static int |
DEFAULT_DISTANCE
|
protected boolean |
isInPool
|
protected boolean |
isLocal
|
Fields inherited from class rice.pastry.dist.DistNodeHandle |
address, 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 | |
DistCoalesedNodeHandle(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. |
boolean |
getIsInPool()
Returns whether or not this node handle is the one in the node handle pool. |
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(Message message)
Called to send a message to the node corresponding to this handle. |
protected abstract void |
receiveMessageImpl(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.dist.DistNodeHandle |
getAddress, getNodeId |
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 transient boolean isInPool
protected transient boolean alive
protected transient boolean isLocal
Constructor Detail |
public DistCoalesedNodeHandle(NodeId nodeId, java.net.InetSocketAddress address)
nodeId
- This node handle's node Id.Method Detail |
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 final void receiveMessage(Message message)
message
- the message.protected abstract void receiveMessageImpl(Message message)
public final java.lang.String toString()
toString
in class DistNodeHandle
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 DistNodeHandle
obj
- the other nodehandle .
public int hashCode()
hashCode
in class DistNodeHandle
protected void debug(java.lang.String s)
s
- The message to print.public void addObserver(java.util.Observer o)
public int countObservers()
public void deleteObserver(java.util.Observer o)
public void deleteObservers()
public boolean hasChanged()
public void notifyObservers()
public void notifyObservers(java.lang.Object arg)
protected void setChanged()
protected void clearChanged()
public void update(java.util.Observable o, java.lang.Object obj)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |