1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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 }