org.khelekore.rnio.impl
Class Acceptor

java.lang.Object
  extended by org.khelekore.rnio.impl.SocketHandlerBase<ServerSocketChannel>
      extended by org.khelekore.rnio.impl.Acceptor
All Implemented Interfaces:
AcceptHandler, SocketChannelHandler

public class Acceptor
extends SocketHandlerBase<ServerSocketChannel>
implements AcceptHandler

A standard acceptor.

This AcceptHandler will never timeout, will never use a separate thread and will keep accepting connections until you remove it.

Author:
Robert Olofsson

Field Summary
 
Fields inherited from class org.khelekore.rnio.impl.SocketHandlerBase
nioHandler, sc, timeout
 
Constructor Summary
Acceptor(ServerSocketChannel ssc, NioHandler nioHandler, AcceptorListener listener)
          Create a new Acceptor that will wait for accepts on the given channel.
 
Method Summary
 void accept()
          Accept a SocketChannel.
 String getDescription()
          Returns the class name and the channel we are using.
 void register()
          Register OP_ACCEPT with the selector.
 
Methods inherited from class org.khelekore.rnio.impl.SocketHandlerBase
closed, getTimeout, timeout, useSeparateThread
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.khelekore.rnio.SocketChannelHandler
closed, getTimeout, timeout, useSeparateThread
 

Constructor Detail

Acceptor

public Acceptor(ServerSocketChannel ssc,
                NioHandler nioHandler,
                AcceptorListener listener)
Create a new Acceptor that will wait for accepts on the given channel.

Parameters:
ssc - the channel to accept connections from
nioHandler - the NioHandler to use for waiting
listener - the listener waiting for connections
Method Detail

getDescription

public String getDescription()
Returns the class name and the channel we are using.

Specified by:
getDescription in interface SocketChannelHandler
Overrides:
getDescription in class SocketHandlerBase<ServerSocketChannel>

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