org.khelekore.rnio.impl
Class Acceptor
java.lang.Object
org.khelekore.rnio.impl.SocketHandlerBase<ServerSocketChannel>
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
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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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 fromnioHandler
- the NioHandler to use for waitinglistener
- the listener waiting for connections
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