org.khelekore.rnio.impl
Class AcceptingServer

java.lang.Object
  extended by org.khelekore.rnio.impl.AcceptingServer

public class AcceptingServer
extends Object

A basic server for rnio.

This server will create a MultiSelectorNioHandler using a BasicStatisticsHolder and the ExecutorService you pass.
When you start this server it will begin to listen for socket connections on the specified InetAddress and port and hand off new socket connections to the AcceptorListener

Author:
Robert Olofsson

Constructor Summary
AcceptingServer(InetAddress addr, int port, AcceptorListener listener, ExecutorService es, int selectorThreads, Long defaultTimeout)
          Create a new server using the parameters given.
 
Method Summary
 NioHandler getNioHandler()
          Get the NioHandler in use by this server.
 void shutdown()
          Shutdown the NioHandler.
 void start()
          Start the NioHandler and register to accept new socket connections.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AcceptingServer

public AcceptingServer(InetAddress addr,
                       int port,
                       AcceptorListener listener,
                       ExecutorService es,
                       int selectorThreads,
                       Long defaultTimeout)
                throws IOException
Create a new server using the parameters given.

Parameters:
addr - the InetAddress to bind to, may be null for wildcard address
port - the port number to bind to
listener - the client that will handle the accepted sockets
es - the ExecutorService to use for the NioHandler
selectorThreads - the number of threads that the NioHandler will use
defaultTimeout - the default timeout value for the NioHandler
Throws:
IOException
Method Detail

start

public void start()
           throws IOException
Start the NioHandler and register to accept new socket connections.

Throws:
IOException

shutdown

public void shutdown()
Shutdown the NioHandler.


getNioHandler

public NioHandler getNioHandler()
Get the NioHandler in use by this server.