hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject RE: DO NOT REPLY [Bug 28296] - [API Doc] Compile performance opt imization guide
Date Tue, 04 Jan 2005 18:46:46 GMT
On Mon, 2004-12-27 at 10:41 -0500, Rezaei, Mohammad A. wrote: 
> I just re-read the first part of the guide (Reuse of HttpClient instance),
> and I think I'm a little confused. How can the instance of HttpClient be
> reused in a thread safe manner (without single threading that instance)? 

Mohammad,

HttpClient#execute method _always_ creates a unique instance of
HttpDirector to actually handle the request. The HTTP state class is
threading safe. As long as the connection manager used is threading safe
HttpClient _should_ be threading safe as well. Feel free to review the
code and let us know if there are any potential threading issues.


> 
> Let me describe how I've setup httpclient and see if you guys think it's
> less than optimal. I've setup a factory class that has this code in it:
> 

The trouble is that the hierarchy of HTTP parameters (aka preference
architecture) is built with assumption there's one to one relationship
between HttpClient and HttpConnectionManager. The connection manager
sort of "inherits" parameters of its agent. The object factory of yours
unfortunately breaks this assumption. To fix the problem you may want to
make all your HttpClient instances share one instance of HttpParams. A
much simpler solution would be to use HttpClient as a singleton.

Hope that clarifies things a little

Cheers,

Oleg



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


Mime
View raw message