rabbit.httpio
Class Acceptor

java.lang.Object
  extended by rabbit.httpio.Acceptor
All Implemented Interfaces:
Runnable, SocketHandler

public class Acceptor
extends Object
implements SocketHandler

A standard acceptor.

Author:
Robert Olofsson

Constructor Summary
Acceptor(ServerSocketChannel ssc, SelectorRunner selectorRunner, Logger logger, AcceptorListener listener)
           
 
Method Summary
 String getDescription()
          Get a string description.
 void register()
          Register OP_ACCEPT with the selector.
 void run()
          Accept a SocketChannel.
 void timeout()
          Handle timeout, since an acceptor should not get timeouts an exception will be thrown.
 boolean useSeparateThread()
          Acceptor runs in the selector thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Acceptor

public Acceptor(ServerSocketChannel ssc,
                SelectorRunner selectorRunner,
                Logger logger,
                AcceptorListener listener)
Method Detail

getDescription

public String getDescription()
Description copied from interface: SocketHandler
Get a string description.

Specified by:
getDescription in interface SocketHandler

useSeparateThread

public boolean useSeparateThread()
Acceptor runs in the selector thread.

Specified by:
useSeparateThread in interface SocketHandler

timeout

public void timeout()
Handle timeout, since an acceptor should not get timeouts an exception will be thrown.

Specified by:
timeout in interface SocketHandler

run

public void run()
Accept a SocketChannel.

Specified by:
run in interface Runnable

register

public void register()
              throws IOException
Register OP_ACCEPT with the selector.

Throws:
IOException