Hi Santosh,

> In previous posts it has been suggested to make HTTPClient singleton. 
> But why ? If HTTPClient gets connection from 
> MultiThreadedHttpConnectionManager connection pool and gives connection 
> back to pool why will connection be gc'ed? what is benefit of  saving 
> HTTPClient object?

The HttpClient object also holds preferences, and a default state.
Indeed we usually recommend a single HttpClient object primarily
because of the connection manager, but there are lots of other
objects which get uselessly re-created over and over again if you
create a new HttpClient object for each request.
So if you have a singleton connection manager anyway, why not
make the HttpClient object a singleton as well?

cheers,
  Roland

Reply via email to