rabbit.httpio
Class Acceptor

java.lang.Object
  extended by rabbit.httpio.Acceptor
All Implemented Interfaces:
AcceptHandler, SocketChannelHandler

public class Acceptor
extends Object
implements AcceptHandler

A standard acceptor.

Author:
Robert Olofsson

Constructor Summary
Acceptor(ServerSocketChannel ssc, NioHandler nioHandler, AcceptorListener listener)
           
 
Method Summary
 void accept()
          Accept a SocketChannel.
 void closed()
           
 String getDescription()
           
 Long getTimeout()
           
 void register()
          Register OP_ACCEPT with the selector.
 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,
                NioHandler nioHandler,
                AcceptorListener listener)
Method Detail

closed

public void closed()
Specified by:
closed in interface SocketChannelHandler

timeout

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

Specified by:
timeout in interface SocketChannelHandler

useSeparateThread

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

Specified by:
useSeparateThread in interface SocketChannelHandler

getDescription

public String getDescription()
Specified by:
getDescription in interface SocketChannelHandler

getTimeout

public Long getTimeout()
Specified by:
getTimeout in interface SocketChannelHandler

accept

public void accept()
Accept a SocketChannel.

Specified by:
accept in interface AcceptHandler

register

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

Throws:
IOException