|
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 | +--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
|
static int |
PING_THROTTLE
|
static int |
SOCKET_BUFFER_SIZE
|
static int |
STATE_USING_TCP
|
static int |
STATE_USING_UDP
|
static int |
STATE_USING_UDP_WAITING_FOR_TCP_DISCONNECT
|
static int |
STATE_USING_UDP_WAITING_TO_DISCONNECT
|
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 | |
WireNodeHandle(java.net.InetSocketAddress address,
rice.pastry.NodeId nid)
Constructor. |
|
WireNodeHandle(java.net.InetSocketAddress address,
rice.pastry.NodeId nid,
rice.pastry.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.LinkedList 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 |
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(rice.pastry.messaging.Message msg)
Called to send a message to the node corresponding to this handle. |
void |
receiveSocketMessage(rice.pastry.wire.messaging.socket.SocketCommandMessage message)
Method which is called when a SocketCommandMessage comes across an open socket for this node handle. |
void |
sendGreetingResponse(rice.pastry.wire.messaging.socket.HelloMessage hm)
|
void |
setKey(java.nio.channels.SelectionKey key,
rice.pastry.wire.messaging.socket.SocketCommandMessage scm)
Method which sets the SelectionKey of this node handle. |
java.lang.String |
toStringImpl()
Returns a String representation of this DistNodeHandle. |
void |
wakeup()
Is called by the SelectorManager every time the manager is awakened. |
void |
write(java.nio.channels.SelectionKey key)
Called by the socket manager whenever this node handle has registered interest in writing to it's remote node, and the socket is ready for writing. |
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 |
public static int STATE_USING_UDP
public static int STATE_USING_TCP
public static int STATE_USING_UDP_WAITING_FOR_TCP_DISCONNECT
public static 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, rice.pastry.NodeId nid)
address
- The address of the host on which this node residesnid
- The NodeId of this hostpublic WireNodeHandle(java.net.InetSocketAddress address, rice.pastry.NodeId nid, rice.pastry.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 void receiveSocketMessage(rice.pastry.wire.messaging.socket.SocketCommandMessage message)
message
- The message coming across the wire.public void receiveMessageImpl(rice.pastry.messaging.Message msg)
receiveMessageImpl
in class DistNodeHandle
msg
- Message to be delivered, may or may not be routeMessage.public void connectToRemoteNode(java.util.LinkedList messages)
public void setKey(java.nio.channels.SelectionKey key, rice.pastry.wire.messaging.socket.SocketCommandMessage scm)
key
- The new SelectionKeypublic void sendGreetingResponse(rice.pastry.wire.messaging.socket.HelloMessage hm)
public void disconnect()
public void accept(java.nio.channels.SelectionKey key)
accept
in interface SelectionKeyHandler
key
- The key which is acceptable.public void connect(java.nio.channels.SelectionKey key)
connect
in interface SelectionKeyHandler
key
- The key which is connectable.public void write(java.nio.channels.SelectionKey key)
write
in interface SelectionKeyHandler
key
- The key which is writable.public void read(java.nio.channels.SelectionKey key)
read
in interface SelectionKeyHandler
key
- The key which is readable.public void wakeup()
wakeup
in interface SelectionKeyHandler
public boolean pingImpl()
pingImpl
in class DistNodeHandle
public void pingStarted()
public void pingResponse()
public java.lang.String toStringImpl()
DistNodeHandle
toStringImpl
in class DistNodeHandle
|
Rice Pastry API | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |