On Tue, 2008-10-14 at 09:58 +0200, Christine wrote: > On Mon, 2008-10-13 at 23:41 +0200, Oleg Kalnichevski wrote: > > On Mon, 2008-10-13 at 10:45 -0700, Mohit Anchlia wrote: > > > What happens when an instance of HttpClient instance is created for > > > each request? Does it internally get associated with one Connection > > > manager or there is new connection manager created for each HttpClient > > > instance? > > > > > > > New connection manager created for each HttpClient instance > > 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? > > Christine >
Christine, 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. 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]
