hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adrian Sutton <adr...@intencha.com>
Subject Re: ConnectionTimeoutException doesn't releaseConnection()
Date Fri, 12 Sep 2003 10:55:01 GMT
On 12/09/2003 8:43 PM, "linea@libero.it" <linea@libero.it> wrote:

> Hi,
> I have noticed that when a ConnectionTimeoutException is thrown,
> HttpConnection 
> doesn't seem to release the connection. If a lot of timeouts are encountered,
> this eventually results in a hang when no more connections are available.
> Instead, the connection seems to be correctly released to the
> MultiThreadedHttpConnectionManager if a read timeout occurs,ie a
> java.net.SocketTimeoutException is thrown.

It's generally considered a bad idea to depend on anyone but yourself to
release the connection.  Essentially it follows the "you took it, you put it
back" method.  So you should use a pattern like:

Try {
} catch (Exception e) {
} finally {

That will guarantee that the method is always released.  A more detailed
example showing the best way to use HttpClient is in the tutorial

Hope that helps,

Adrian Sutton.

Intencha "tomorrow's technology today"
Ph: 38478913 0422236329
Suite 8/29 Oatland Crescent
Holland Park West 4121
Australia QLD

To unsubscribe, e-mail: commons-httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-httpclient-dev-help@jakarta.apache.org

View raw message