org.apache.avalon.cornerstone.services.connection
Interface ConnectionManager

All Known Implementing Classes:
AbstractConnectionManager, CDIConnectionManager, DefaultConnectionManager

public interface ConnectionManager

This is the service through which ConnectionManagement occurs.

Author:
Avalon Development Team

Field Summary
static java.lang.String ROLE
           
 
Method Summary
 void connect(java.lang.String name, java.net.ServerSocket socket, ConnectionHandlerFactory handlerFactory)
          Start managing a connection.
 void connect(java.lang.String name, java.net.ServerSocket socket, ConnectionHandlerFactory handlerFactory, ThreadPool threadPool)
          Start managing a connection.
 void disconnect(java.lang.String name)
          This shuts down all handlers and socket, waiting for each to gracefully shutdown.
 void disconnect(java.lang.String name, boolean tearDown)
          This shuts down all handlers and socket.
 

Field Detail

ROLE

public static final java.lang.String ROLE
Method Detail

connect

public void connect(java.lang.String name,
                    java.net.ServerSocket socket,
                    ConnectionHandlerFactory handlerFactory,
                    ThreadPool threadPool)
             throws java.lang.Exception
Start managing a connection. Management involves accepting connections and farming them out to threads from pool to be handled.

Parameters:
name - the name of connection
socket - the ServerSocket from which to
handlerFactory - the factory from which to aquire handlers
threadPool - the thread pool to use
Throws:
java.lang.Exception - if an error occurs

connect

public void connect(java.lang.String name,
                    java.net.ServerSocket socket,
                    ConnectionHandlerFactory handlerFactory)
             throws java.lang.Exception
Start managing a connection. This is similar to other connect method except that it uses default thread pool.

Parameters:
name - the name of connection
socket - the ServerSocket from which to
handlerFactory - the factory from which to aquire handlers
Throws:
java.lang.Exception - if an error occurs

disconnect

public void disconnect(java.lang.String name)
                throws java.lang.Exception
This shuts down all handlers and socket, waiting for each to gracefully shutdown.

Parameters:
name - the name of connection
Throws:
java.lang.Exception - if an error occurs

disconnect

public void disconnect(java.lang.String name,
                       boolean tearDown)
                throws java.lang.Exception
This shuts down all handlers and socket. If tearDown is true then it will forcefully shutdown all connections and try to return as soon as possible. Otherwise it will behave the same as void disconnect( String name );

Parameters:
name - the name of connection
tearDown - if true will forcefully tear down all handlers
Throws:
java.lang.Exception - if an error occurs


Copyright © 1997-2005 The Apache Software Foundation. All Rights Reserved.