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()
          Signal that the channel has been closed.
 String getDescription()
          Get a string description.
 Long getTimeout()
          Get the timeout time in millis.
 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()
Description copied from interface: SocketChannelHandler
Signal that the channel has been 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()
Description copied from interface: SocketChannelHandler
Get a string description.

Specified by:
getDescription in interface SocketChannelHandler

getTimeout

public Long getTimeout()
Description copied from interface: SocketChannelHandler
Get the timeout time in millis.

Specified by:
getTimeout in interface SocketChannelHandler
Returns:
the time when this operation times out, null if no timeout is set.

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