hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Johnson <e...@tibco.com>
Subject Re: Moving to 2.0a2
Date Fri, 07 Feb 2003 14:56:43 GMT

>Are you sure I have too ? It seems that in the end HttpMethodBase
>executeMethod (line 957), there's a call to release the connection used.
HttpClient changes quickly, so line 957 doesn't seem to match any more. 
 If I assume correctly that you are referring to the function 
"ensureConnectionRelease", the
if (doneWithConnection) clause surrounding the release call is crucial, 
in that more often than not, the "doneWithConnection" flag is _false_. 
 The connection will only be closed at this point if the "response" has 
been fully parsed.  It is likely that this will only happen on certain 
types of requests, like the "HEAD" method, or if you override the 
respective HttpMethod in some interesting way.

You have numerous choices, all of which should "recycle" the connection 
appropriately.  I think the following list misses some options, but 
should give you an idea - all functions are on HttpMethod.

    * call getResponseBodyAsStream(), and eventually call "close" on the
      returned stream, which has the effect of recycling the connection.
    * getResponseBody() - calls getResponseBodyAsStream() for you, and
      also calls close on the stream.
    * getResponseBodyAsString() - a convenience wrapper around
    * releaseConnection() - just calls close directly on the equivalent
      of the result from getResponseBodyAsStream().

Hopefully this clarifies, rather than confuses!

-Eric Johnson.

View raw message