hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Becke <be...@u.washington.edu>
Subject Re: Moving to 2.0a2
Date Fri, 07 Feb 2003 14:43:06 GMT
> I've seen it, but I think this means I have to use on HttpClient for each
> user, cause it's using it's private HttpState to execute the request...
> If there was a HttpClient.executeMethod(HttpState state, HttpConnection
> conn), that would work, but in my case that's why I first did the "hack" in
> the nightly (ex multiclient), to avoid multiple clients (memory / perf...).
> Am I right ?

You do not need to use HttpClient in particular.  I would just suggest 
you look at it to make sure you've covered all of your bases.

> 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.

Yes, you definitely need to release the connection.  HttpMethodBase only 
releases connections when there is no response body to be read (e.g. the 
response content length is 0).  I would suggest something like the 
following:

         try {
             method.execute(state, connection);
             // process method response here if appropriate
         } finally {
             // either we're done or an error occured, either way we want
             // to relase the connection
             method.releaseConnection();
         }

This way you can be sure that all connections are released.  There are a 
number of ways that a connection can be released implicitly, but it is 
best to be sure by doing it explicitly.  There is no harm is calling 
method.releaseConnection() even after the connection has already been 
released.

Enjoy,

Mike


Mime
View raw message