|
||||||||||
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
rice.pastry.wire.WireNodeHandle
Class which represents a node handle in the socket-based pastry protocol. Initially, all of the messages are sent over UDP. If a message is too large to be sent over the UDP protocol (as determined by the MAX_UDP_MESSAGE_SIZE), then a socket connection is opened to the remote node.
Field Summary | |
static int |
MAX_UDP_MESSAGE_SIZE
the largest message size to send over UDP |
static int |
PING_THROTTLE
the throttle (pings only sent this many seconds) |
static int |
SOCKET_BUFFER_SIZE
the size of the "receive" buffer for the socket |
static int |
STATE_USING_TCP
using TCP |
static int |
STATE_USING_UDP
using UDP |
static int |
STATE_USING_UDP_WAITING_FOR_TCP_DISCONNECT
waiting to disconnect from TCP from remote side |
static int |
STATE_USING_UDP_WAITING_TO_DISCONNECT
waiting to disconnect |
Fields inherited from class rice.pastry.dist.DistCoalesedNodeHandle |
alive, DEFAULT_DISTANCE, isInPool, 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 | |
WireNodeHandle(java.net.InetSocketAddress address,
NodeId nid)
Constructor. |
|
WireNodeHandle(java.net.InetSocketAddress address,
NodeId nid,
PastryNode pn)
Alternate constructor with local Pastry node. |
Method Summary | |
void |
accept(java.nio.channels.SelectionKey key)
Requeired by the SelectionKeyHandler interface. |
void |
connect(java.nio.channels.SelectionKey key)
Called by the socket manager whnever this node handle needs to complete it's connection to it's remote node. |
void |
connectToRemoteNode(java.util.Iterator messages)
Method which initiates a connection to a remote node. |
void |
disconnect()
Method that is designed to be called by the SocketManager when it wishes for this node handle to disconnect. |
int |
getState()
Returns the state of this WireNodeHandle |
boolean |
isWriteEnabled()
Gets the WriteEnabled attribute of the WireNodeHandle object |
void |
notifyKilled()
prints Potentially lost the message for all messages in queue |
void |
notifyPotentiallyLostMessage(java.util.Iterator i)
prints Potentially lost the message for all messages in the iterator |
boolean |
pingImpl()
Ping the remote node now, and update the proximity metric. |
void |
pingResponse()
Method which is called by the SocketPingManager when a ping response comes back for this node. |
void |
pingStarted()
Method which is called by the PingMessage right before it is going to be sent across the wire. |
void |
read(java.nio.channels.SelectionKey key)
Called by the socket manager whenever there is data to be read from this node handle's remote node. |
void |
receiveMessageImpl(Message msg)
Called to send a message to the node corresponding to this handle. |
void |
receiveSocketMessage(SocketCommandMessage message)
Method which is called when a SocketCommandMessage comes across an open socket for this node handle. |
void |
setKey(java.nio.channels.SelectionKey key,
SocketCommandMessage scm)
Method which sets the SelectionKey of this node handle. |
java.lang.String |
toStringImpl()
implementation for toString() |
void |
write(java.nio.channels.SelectionKey key)
Method which is called when the key becomes writable. |
Methods inherited from class rice.pastry.dist.DistCoalesedNodeHandle |
addObserver, afterSetLocalNode, clearChanged, countObservers, debug, deleteObserver, deleteObservers, equals, getIsInPool, hasChanged, hashCode, isAlive, markAlive, markDead, notifyObservers, notifyObservers, ping, proximity, receiveMessage, setChanged, setIsInPool, setProximity, toString, update |
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 final int STATE_USING_UDP
public static final int STATE_USING_TCP
public static final int STATE_USING_UDP_WAITING_FOR_TCP_DISCONNECT
public static final int STATE_USING_UDP_WAITING_TO_DISCONNECT
public static int MAX_UDP_MESSAGE_SIZE
public static int SOCKET_BUFFER_SIZE
public static int PING_THROTTLE
Constructor Detail |
public WireNodeHandle(java.net.InetSocketAddress address, NodeId nid)
address
- The address of the host on which this node residesnid
- The NodeId of this hostpublic WireNodeHandle(java.net.InetSocketAddress address, NodeId nid, PastryNode pn)
address
- The address of the host on which this node residesnid
- The NodeId of this hostpn
- The local Pastry nodeMethod Detail |
public int getState()
public boolean isWriteEnabled()
public void setKey(java.nio.channels.SelectionKey key, SocketCommandMessage scm)
key
- The new SelectionKeyscm
- The new Key valuepublic void receiveSocketMessage(SocketCommandMessage message)
message
- The message coming across the wire.public void notifyKilled()
public void receiveMessageImpl(Message msg)
receiveMessageImpl
in class DistCoalesedNodeHandle
msg
- Message to be delivered, may or may not be routeMessage.public void notifyPotentiallyLostMessage(java.util.Iterator i)
i
- an iterator of messages to print out the error message forpublic void connectToRemoteNode(java.util.Iterator messages)
messages
- the initial queuepublic void disconnect()
public void accept(java.nio.channels.SelectionKey key)
accept
in interface SelectionKeyHandler
key
- DESCRIBE THE PARAMETERpublic void connect(java.nio.channels.SelectionKey key)
connect
in interface SelectionKeyHandler
key
- DESCRIBE THE PARAMETERpublic void write(java.nio.channels.SelectionKey key)
SelectionKeyHandler
write
in interface SelectionKeyHandler
key
- The key which is writable.public void read(java.nio.channels.SelectionKey key)
read
in interface SelectionKeyHandler
key
- DESCRIBE THE PARAMETERpublic boolean pingImpl()
pingImpl
in class DistCoalesedNodeHandle
public void pingStarted()
public void pingResponse()
public java.lang.String toStringImpl()
toStringImpl
in class DistCoalesedNodeHandle
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |