For that matter is it a good practice to set a HttpClient with a ThreadSafeClientConnManager in the ServletContext of a webapp, and to reuse the HttpClient ?
>-------- Оригинално писмо -------- >От: Oleg Kalnichevski >Относно: Re: ThreadSafeClientConnManager >До: HttpClient User Discussion >Изпратено на: Сряда, 2010, Септември 22 17:59:01 EEST >On Tue, 2010-09-21 at 16:58 +0200, [email protected] wrote: >> Hi all. >> >> From httpclient documentation and mailing list I read, that ... >> >> a) one should use ThreadSafeClientConnManager, "if more than one thread is >> using >> the HttpClient" >> >> b) a SingleClientConnManager "ought to be used by one execution thread only" >> >> ... yet I'm not 100% sure, whether ... >> >> (a) above just means the case "where multiple threads share a particular >> _instance_ of DefaultHttpClient" as opposed to "when multiple threads use >> Apache >> http client lib in general" (even if each thread had its own >> DefaultHttpClient >> instance?) >> > >That implies a particular instance of HttpClient shared by multiple >threads. However, users are generally advised to have only one instance >of HttpClient per distinct HTTP service. > > >> and whether (b) above means that "only one particular instance >> of SingleClientConnManager should be used within one thread" or whether it >> should be read as "there must be only one thread per runtime, that is >> making use >> of any SingleClientConnManager instance(s)" >> > >The former. One generally should have one instance of >SingleClientConnManager per execution thread. > >Hope this helps > >Oleg > > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: [email protected] >For additional commands, e-mail: [email protected] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
