org.apache.avalon.cornerstone.blocks.connection
Class DefaultConnectionManager
java.lang.Object
|
+--org.apache.avalon.framework.logger.AbstractLogEnabled
|
+--org.apache.avalon.cornerstone.blocks.connection.DefaultConnectionManager
- All Implemented Interfaces:
- org.apache.avalon.cornerstone.services.connection.ConnectionManager, Disposable, LogEnabled, Serviceable
- public class DefaultConnectionManager
- extends AbstractLogEnabled
- implements org.apache.avalon.cornerstone.services.connection.ConnectionManager, Serviceable, Disposable
This is the service through which ConnectionManagement occurs.
- Author:
- Avalon Development Team
Fields inherited from interface org.apache.avalon.cornerstone.services.connection.ConnectionManager |
ROLE |
Method Summary |
void |
connect(String name,
ServerSocket socket,
org.apache.avalon.cornerstone.services.connection.ConnectionHandlerFactory handlerFactory)
Start managing a connection.
|
void |
connect(String name,
ServerSocket socket,
org.apache.avalon.cornerstone.services.connection.ConnectionHandlerFactory handlerFactory,
org.apache.avalon.excalibur.thread.ThreadPool threadPool)
Start managing a connection.
|
void |
disconnect(String name)
This shuts down all handlers and socket, waiting for each to gracefully shutdown. |
void |
disconnect(String name,
boolean tearDown)
This shuts down all handlers and socket.
|
void |
dispose()
|
void |
service(ServiceManager serviceManager)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DefaultConnectionManager
public DefaultConnectionManager()
service
public void service(ServiceManager serviceManager)
throws ServiceException
- Specified by:
service
in interface Serviceable
ServiceException
dispose
public void dispose()
- Specified by:
dispose
in interface Disposable
connect
public void connect(String name,
ServerSocket socket,
org.apache.avalon.cornerstone.services.connection.ConnectionHandlerFactory handlerFactory,
org.apache.avalon.excalibur.thread.ThreadPool threadPool)
throws Exception
- Start managing a connection.
Management involves accepting connections and farming them out to threads
from pool to be handled.
- Specified by:
connect
in interface org.apache.avalon.cornerstone.services.connection.ConnectionManager
- Parameters:
name
- the name of connectionsocket
- the ServerSocket from which tohandlerFactory
- the factory from which to aquire handlersthreadPool
- the thread pool to use
- Throws:
Exception
- if an error occurs
connect
public void connect(String name,
ServerSocket socket,
org.apache.avalon.cornerstone.services.connection.ConnectionHandlerFactory handlerFactory)
throws Exception
- Start managing a connection.
This is similar to other connect method except that it uses default thread pool.
- Specified by:
connect
in interface org.apache.avalon.cornerstone.services.connection.ConnectionManager
- Parameters:
name
- the name of connectionsocket
- the ServerSocket from which tohandlerFactory
- the factory from which to aquire handlers
- Throws:
Exception
- if an error occurs
disconnect
public void disconnect(String name)
throws Exception
- This shuts down all handlers and socket, waiting for each to gracefully shutdown.
- Specified by:
disconnect
in interface org.apache.avalon.cornerstone.services.connection.ConnectionManager
- Parameters:
name
- the name of connection
- Throws:
Exception
- if an error occurs
disconnect
public void disconnect(String name,
boolean tearDown)
throws 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 );
- Specified by:
disconnect
in interface org.apache.avalon.cornerstone.services.connection.ConnectionManager
- Parameters:
name
- the name of connectiontearDown
- if true will forcefully tear down all handlers
- Throws:
Exception
- if an error occurs
Copyright © 2001-2003 Apache Software Foundation. All Rights Reserved.