Rice Pastry API

org.mpisws.p2p.transport.wire
Class TCPLayer

java.lang.Object
  extended by rice.selector.SelectionKeyHandler
      extended by org.mpisws.p2p.transport.wire.TCPLayer

public class TCPLayer
extends SelectionKeyHandler


Field Summary
 int MAX_OPEN_SOCKETS
           
static java.util.Map<java.lang.String,java.lang.Object> OPTIONS
           
 int SOCKET_BUFFER_SIZE
           
 boolean TCP_NO_DELAY
           
 
Constructor Summary
TCPLayer(WireTransportLayerImpl wire, boolean enableServer)
          Which socket to collect.
 
Method Summary
 void accept(java.nio.channels.SelectionKey key)
          Specified by the SelectionKeyHandler interface.
 void acceptSockets(boolean b)
           
 void destroy()
          Method which cloeses a socket to a given remote node handle, and updates the bookkeeping to keep track of this closing.
 boolean isDestroyed()
           
 SocketRequestHandle<java.net.InetSocketAddress> openSocket(java.net.InetSocketAddress destination, SocketCallback<java.net.InetSocketAddress> deliverSocketToMe, java.util.Map<java.lang.String,java.lang.Object> options)
           
protected  void socketClosed(SocketManager sm)
           
 
Methods inherited from class rice.selector.SelectionKeyHandler
connect, modifyKey, read, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OPTIONS

public static final java.util.Map<java.lang.String,java.lang.Object> OPTIONS

MAX_OPEN_SOCKETS

public final int MAX_OPEN_SOCKETS

SOCKET_BUFFER_SIZE

public final int SOCKET_BUFFER_SIZE

TCP_NO_DELAY

public boolean TCP_NO_DELAY
Constructor Detail

TCPLayer

public TCPLayer(WireTransportLayerImpl wire,
                boolean enableServer)
         throws java.io.IOException
Which socket to collect.

Throws:
java.io.IOException
Method Detail

openSocket

public SocketRequestHandle<java.net.InetSocketAddress> openSocket(java.net.InetSocketAddress destination,
                                                                  SocketCallback<java.net.InetSocketAddress> deliverSocketToMe,
                                                                  java.util.Map<java.lang.String,java.lang.Object> options)

socketClosed

protected void socketClosed(SocketManager sm)

destroy

public void destroy()
Method which cloeses a socket to a given remote node handle, and updates the bookkeeping to keep track of this closing. Note that this method does not completely close the socket, rather, it simply calls shutdown(), which starts the shutdown process.

Parameters:
address - The address of the remote node

acceptSockets

public void acceptSockets(boolean b)

accept

public void accept(java.nio.channels.SelectionKey key)
Specified by the SelectionKeyHandler interface. Is called whenever a key has become acceptable, representing an incoming connection. This method will accept the connection, and attach a SocketConnector in order to read the greeting off of the channel. Once the greeting has been read, the connector will hand the channel off to the appropriate node handle.

Overrides:
accept in class SelectionKeyHandler
Parameters:
key - The key which is acceptable.

isDestroyed

public boolean isDestroyed()

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection