On Wed, 2010-10-06 at 23:21 +0200, Antonio Sánchez wrote: > Hi. > > I'm developing a Swing client application for requesting a web > application (Struts2). > > This client application is required to deal with concurrent requests > (SwingWorkers) that will finally be performed using HttpClient4. > > All request will have the same URL: "http://www.myhost.com/mywebapp", > only query string will change: > "http://www.myhost.com/mywebapp/myrequest?myparam=myvalue". > > The application must be session aware (JSESSIONID cookie) and possibly > will require to generally manage some other HTTP state. > > My questions: > > 1. Should I share the same HttpClient instance for all requests > (concurrent or not)? Or should I instantiate a new HttpClient for every > new request (concurrent or not)? >
You should be re-using the same instance of HttpClient > 2. Should I use a 'ThreadSafeClientConnManager as stated in > http://hc.apache.org/httpcomponents-client-4.0.3/tutorial/html/connmgmt.html#d4e629 > ? Or using a new HttpClient instance for every concurrent request is enough? > You should be using the same instance of pooling connection manager such as ThreadSafeClientConnManager for all requests. Oleg --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
