KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > httpclient > HttpConnectionManager


1 /*
2  * $Header: /home/cvs/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/HttpConnectionManager.java,v 1.15.2.1 2004/02/22 18:21:13 olegk Exp $
3  * $Revision: 1.15.2.1 $
4  * $Date: 2004/02/22 18:21:13 $
5  *
6  * ====================================================================
7  *
8  * Copyright 1999-2004 The Apache Software Foundation
9  *
10  * Licensed under the Apache License, Version 2.0 (the "License");
11  * you may not use this file except in compliance with the License.
12  * You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS,
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  * ====================================================================
22  *
23  * This software consists of voluntary contributions made by many
24  * individuals on behalf of the Apache Software Foundation. For more
25  * information on the Apache Software Foundation, please see
26  * <http://www.apache.org/>.
27  *
28  * [Additional notices, if required by prior licensing conditions]
29  *
30  */

31
32 package org.apache.commons.httpclient;
33
34 /**
35  * An interface for classes that manage HttpConnections.
36  *
37  * @see org.apache.commons.httpclient.HttpConnection
38  * @see org.apache.commons.httpclient.HttpClient#HttpClient(HttpConnectionManager)
39  *
40  * @author Unascribed
41  * @author <a HREF="mailto:mbowler@GargoyleSoftware.com">Mike Bowler</a>
42  *
43  * @since 2.0
44  */

45 public interface HttpConnectionManager {
46
47     /**
48      * Gets an HttpConnection for a given host configuration. If a connection is
49      * not available this method will block until one is.
50      *
51      * The connection manager should be registered with any HttpConnection that
52      * is created.
53      *
54      * @param hostConfiguration the host configuration to use to configure the
55      * connection
56      *
57      * @return an HttpConnection for the given configuration
58      *
59      * @see HttpConnection#setHttpConnectionManager(HttpConnectionManager)
60      */

61     HttpConnection getConnection(HostConfiguration hostConfiguration);
62
63     /**
64      * Gets an HttpConnection for a given host configuration. If a connection is
65      * not available, this method will block for at most the specified number of
66      * milliseconds or until a connection becomes available.
67      *
68      * The connection manager should be registered with any HttpConnection that
69      * is created.
70      *
71      * @param hostConfiguration the host configuration to use to configure the
72      * connection
73      * @param timeout - the time (in milliseconds) to wait for a connection to
74      * become available, 0 to specify an infinite timeout
75      *
76      * @return an HttpConnection for the given configuraiton
77      *
78      * @throws HttpException if no connection becomes available before the
79      * timeout expires
80      *
81      * @see HttpConnection#setHttpConnectionManager(HttpConnectionManager)
82      */

83     HttpConnection getConnection(HostConfiguration hostConfiguration, long timeout)
84         throws HttpException;
85
86     /**
87      * Releases the given HttpConnection for use by other requests.
88      *
89      * @param conn - The HttpConnection to make available.
90      */

91     void releaseConnection(HttpConnection conn);
92 }
93
Popular Tags