KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > james > services > JamesConnectionManager


1 /***********************************************************************
2  * Copyright (c) 2000-2004 The Apache Software Foundation. *
3  * All rights reserved. *
4  * ------------------------------------------------------------------- *
5  * Licensed under the Apache License, Version 2.0 (the "License"); you *
6  * may not use this file except in compliance with the License. You *
7  * may obtain a copy of the License at: *
8  * *
9  * http://www.apache.org/licenses/LICENSE-2.0 *
10  * *
11  * Unless required by applicable law or agreed to in writing, software *
12  * distributed under the License is distributed on an "AS IS" BASIS, *
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or *
14  * implied. See the License for the specific language governing *
15  * permissions and limitations under the License. *
16  ***********************************************************************/

17
18
19 package org.apache.james.services;
20
21
22 import org.apache.avalon.cornerstone.services.connection.ConnectionManager;
23 import java.net.ServerSocket JavaDoc;
24 import org.apache.avalon.excalibur.thread.ThreadPool;
25 import org.apache.avalon.cornerstone.services.connection.ConnectionHandlerFactory;
26
27 /**
28  * This interface extends the standard ConnectionManager interface to allow
29  * connectionLimits to be specified on a per service basis
30  **/

31 public interface JamesConnectionManager extends ConnectionManager
32 {
33     /**
34      * The component role used by components implementing this service
35      */

36     String JavaDoc ROLE = "org.apache.james.services.JamesConnectionManager";
37
38     /**
39      * Returns the default maximum number of open connections supported by this
40      * SimpleConnectionManager
41      *
42      * @return the maximum number of connections
43      */

44     int getMaximumNumberOfOpenConnections();
45
46     /**
47      * Start managing a connection.
48      * Management involves accepting connections and farming them out to threads
49      * from pool to be handled.
50      *
51      * @param name the name of connection
52      * @param socket the ServerSocket from which to
53      * @param handlerFactory the factory from which to acquire handlers
54      * @param threadPool the thread pool to use
55      * @param maxOpenConnections the maximum number of open connections allowed for this server socket.
56      * @exception Exception if an error occurs
57      */

58     void connect( String JavaDoc name,
59                   ServerSocket JavaDoc socket,
60                   ConnectionHandlerFactory handlerFactory,
61                   ThreadPool threadPool,
62                   int maxOpenConnections )
63         throws Exception JavaDoc;
64     
65     /**
66      * Start managing a connection.
67      * This is similar to other connect method except that it uses default thread pool.
68      *
69      * @param name the name of connection
70      * @param socket the ServerSocket from which to
71      * @param handlerFactory the factory from which to acquire handlers
72      * @param maxOpenConnections the maximum number of open connections allowed for this server socket.
73      * @exception Exception if an error occurs
74      */

75     void connect( String JavaDoc name,
76                   ServerSocket JavaDoc socket,
77                   ConnectionHandlerFactory handlerFactory,
78                   int maxOpenConnections )
79         throws Exception JavaDoc;
80
81 }
82
Popular Tags