org.codehaus.spice.netserve.connection
Interface SocketAcceptorManager

All Known Implementing Classes:
DefaultAcceptorManager

public interface SocketAcceptorManager

This service is used to manage network acceptors. The service takes a ServerSocket and RequestHandler and anytime a new connection is accepted the handler is called with the new socket connection.

Version:
$Revision: 1.2 $ $Date: 2004/03/21 23:43:00 $
Author:
Peter Donald

Method Summary
 void connect(String name, ServerSocket socket, RequestHandler handler)
          Start accepting connections from a socket and passing connections to specified handler.
 void disconnect(String name)
          This shuts down the named acceptor.
 boolean isConnected(String name)
          Return true if acceptor with specified name exists.
 

Method Detail

connect

public void connect(String name,
                    ServerSocket socket,
                    RequestHandler handler)
             throws Exception
Start accepting connections from a socket and passing connections to specified handler.

Parameters:
name - the name of connection. This serves as a key used to shutdown acceptor.
socket - the ServerSocket from which connections are accepted
Throws:
Exception - if unable to initiate connection management. This could be due to the key already being used for another acceptor, the serversocket being closed, the handler being null etc.

disconnect

public void disconnect(String name)
This shuts down the named acceptor. NOTE: It is the responsibility of the caller to make sure that the ServerSocket has been closed.

Parameters:
name - the name of connection
Throws:
IllegalArgumentException - if no connection with specified name

isConnected

public boolean isConnected(String name)
Return true if acceptor with specified name exists.

Parameters:
name - the name
Returns:
true if acceptor with specified name exists.


Copyright © 1999-2004 Codehaus. All Rights Reserved.