Rice Pastry API

rice.pastry.socket
Class SocketCollectionManager.SocketAccepter

java.lang.Object
  extended by rice.selector.SelectionKeyHandler
      extended by rice.pastry.socket.SocketCollectionManager.SocketAccepter
Enclosing class:
SocketCollectionManager

protected class SocketCollectionManager.SocketAccepter
extends SelectionKeyHandler

Internal class which reads the greeting message off of a newly-accepted socket. This class determines whether this is a normal connection or a source-route request, and then hands the connection off to the appropriate handler (SocketManager or SourceRouteManager).


Constructor Summary
SocketCollectionManager.SocketAccepter(java.nio.channels.SelectionKey key)
          Constructor which accepts an incoming connection, represented by the selection key.
 
Method Summary
protected  void acceptConnection(java.nio.channels.SelectionKey serverKey)
          Accepts a new connection on the given key
 void close()
          Method which closes down this socket manager, by closing the socket, cancelling the key and setting the key to be interested in nothing
 void read(java.nio.channels.SelectionKey key)
          Reads from the socket attached to this connector.
 
Methods inherited from class rice.selector.SelectionKeyHandler
accept, connect, modifyKey, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SocketCollectionManager.SocketAccepter

public SocketCollectionManager.SocketAccepter(java.nio.channels.SelectionKey key)
                                       throws java.io.IOException
Constructor which accepts an incoming connection, represented by the selection key. This constructor builds a new IntermediateSourceRouteManager, and waits until the greeting message is read from the other end. Once the greeting is received, the manager makes sure that a socket for this handle is not already open, and then proceeds as normal.

Parameters:
key - The server accepting key for the channel
Throws:
java.io.IOException - DESCRIBE THE EXCEPTION
Method Detail

close

public void close()
Method which closes down this socket manager, by closing the socket, cancelling the key and setting the key to be interested in nothing


acceptConnection

protected void acceptConnection(java.nio.channels.SelectionKey serverKey)
                         throws java.io.IOException
Accepts a new connection on the given key

Parameters:
serverKey - The server socket key
Throws:
java.io.IOException - DESCRIBE THE EXCEPTION

read

public void read(java.nio.channels.SelectionKey key)
Reads from the socket attached to this connector.

Overrides:
read in class SelectionKeyHandler
Parameters:
key - The selection key for this manager

Rice Pastry API

Copyright © 2001-2005 - Rice Pastry.


Imprint-Dataprotection