On Tue, 2008-10-14 at 23:44 +0200, Oleg Kalnichevski wrote: > > What is the tradeoff between using the same httpClient instance again > > and again, or creating a new one on each request? Can you create a > > memory leak by using one instance and not closing connections properly? > > > It very much depends on what you are trying to accomplish. Generally it > is recommended to reuse the HttpClient instance in order to utilize > persistent connections more efficiently. > > What is very important that the connection manager associated with the > HttpClient instance is shut down when it is no longer needed. Otherwise, > connections will stay open until garbage collected by the JVM, which may > take a while. If too many instances of HttpClient are created in a tight > loop without being correctly shut down, there will be too many > connections kept alive needlessly and the system can run out of > resources.
Oleg, thanks for the reply. I am reusing one instance, but I was just wondering. Using one instance I don't have to shut down connection managers, right? btw, I'm still a bit confused after switching from 3.x to 4.0, but you guys have the documentation right, now. I think you did a good job. Christine > > Hope this helps > > Oleg > > > > > > > > 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] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] -- dagdag is just a two character rotation of byebye www.christine.nl --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]