hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: Multithreaded http client application: how-to?
Date Thu, 14 Oct 2010 20:38:29 GMT
On Thu, 2010-10-14 at 09:20 -0700, Antonio Sanchez wrote:
> Thanks Oleg.
> 
> 
> olegk wrote:
> > 
> > You should be re-using the same instance of HttpClient
> > 
> 
> Do I need to synchronize access to the HttpClient instance?
> 

No, you do not. DefaultHttpClient is fully thread-safe *as long as* all
dependent interface implementations (connection manager, auth handlers,
redirect strategy, keep alive strategy and so on) injected by the user
are thread-safe. 

> 
> olegk wrote:
> > 
> > You should be using the same instance of pooling connection manager such
> > as ThreadSafeClientConnManager for all requests.
> > 
> 
> How does ThreadSafeClientConnManager work? Does it just synchronize the
> management of internal connection resources? Or does it behaves in a true
> concurrent fashion having multiple transfers at the very same time though my
> one HttpClient instance?
> 

It is the latter. Feel free to review the source, though, to form an
opinion.

Oleg


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


Mime
View raw message