org.szegedi.nioserver
Interface ProtocolHandlerFactory

All Known Implementing Classes:
EchoProtocolHandlerFactory, HttpProtocolHandlerFactory

public interface ProtocolHandlerFactory

An interface for factories of protocol handlers. A single protocol handler factory is associated with each serviced server socket. When a connection is accepted on the server socket, a new protocol handler is requested from the factory and associated with the connection.

Version:
$Id: ProtocolHandlerFactory.java,v 1.2 2002/02/11 08:18:30 szegedia Exp $
Author:
Attila Szegedi, szegedia at freemail dot hu

Method Summary
 ProtocolHandler createProtocolHandler(java.nio.channels.SocketChannel channel)
          Called whenever a connection is accepted on a server socket for which this factory was registered.
 

Method Detail

createProtocolHandler

public ProtocolHandler createProtocolHandler(java.nio.channels.SocketChannel channel)
Called whenever a connection is accepted on a server socket for which this factory was registered.

Parameters:
channel - the server socket channel that represents the server-side of the connection.
Returns:
a protocol handler instance (either new or pooled) that will service the read and write operations on the socket. Returning null will cause the server to refuse the connection.