rice.pastry.wire
Class TcpNodeHandle

java.lang.Object
  |
  +--java.util.Observable
        |
        +--rice.pastry.NodeHandle
              |
              +--rice.pastry.dist.DistNodeHandle
                    |
                    +--rice.pastry.wire.WireNodeHandle
                          |
                          +--rice.pastry.wire.TcpNodeHandle
All Implemented Interfaces:
rice.pastry.LocalNodeI, rice.pastry.messaging.MessageReceiver, rice.p2p.commonapi.NodeHandle, java.util.Observer, rice.pastry.wire.SelectionKeyHandler, java.io.Serializable

public class TcpNodeHandle
extends WireNodeHandle

Node handle that use TCP to transmit messages. Notice the call to receiveMessageImpl may block, see the modification to SocketChannelWriter class where we restrict its internal queue be 1 and the enqueue method may block as well.

Version:
$Id: TcpNodeHandle.java,v 1.2 2003/09/20 21:35:53 glchen Exp $
Author:
Guanling Chen
See Also:
Serialized Form

Field Summary
 
Fields inherited from class rice.pastry.wire.WireNodeHandle
key, MAX_UDP_MESSAGE_SIZE, PING_THROTTLE, reader, SOCKET_BUFFER_SIZE, state, STATE_USING_TCP, STATE_USING_UDP, STATE_USING_UDP_WAITING_FOR_TCP_DISCONNECT, STATE_USING_UDP_WAITING_TO_DISCONNECT, writer
 
Fields inherited from class rice.pastry.dist.DistNodeHandle
address, alive, isInPool, isLocal, nodeId
 
Fields inherited from class rice.pastry.NodeHandle
DECLARED_DEAD, DECLARED_LIVE, PROXIMITY_CHANGED
 
Fields inherited from class java.util.Observable
 
Fields inherited from interface rice.pastry.LocalNodeI
pending
 
Constructor Summary
TcpNodeHandle(java.net.InetSocketAddress address, rice.pastry.NodeId nid)
           
TcpNodeHandle(java.net.InetSocketAddress address, rice.pastry.NodeId nid, rice.pastry.PastryNode pn)
           
 
Method Summary
 void receiveMessageImpl(rice.pastry.messaging.Message msg)
          Called to send a message to the node corresponding to this handle.
 
Methods inherited from class rice.pastry.wire.WireNodeHandle
accept, connect, connectToRemoteNode, disconnect, getState, messageSize, pingImpl, pingResponse, pingStarted, read, receiveSocketMessage, sendGreetingResponse, setKey, toStringImpl, wakeup, write
 
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
 

Constructor Detail

TcpNodeHandle

public TcpNodeHandle(java.net.InetSocketAddress address,
                     rice.pastry.NodeId nid)

TcpNodeHandle

public TcpNodeHandle(java.net.InetSocketAddress address,
                     rice.pastry.NodeId nid,
                     rice.pastry.PastryNode pn)
Method Detail

receiveMessageImpl

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

Overrides:
receiveMessageImpl in class WireNodeHandle
Parameters:
msg - Message to be delivered, may or may not be routeMessage.