Well, that's the thing. The HttpState will be wrapped up in the singleton. Some of the servers we support will allow up to 32 simultaneous threads of execution. How will that work when all posts are done via a singleton?
--Steve -----Original Message----- From: Roland Weber [mailto:[EMAIL PROTECTED] Sent: Friday, February 09, 2007 1:14 AM To: HttpClient User Discussion Subject: Re: Is this a good idea? Hello Steve, > I think I am losing an argument at work. A coworker is implementing > some code that will be used to call a servlet. HttpClient is the tool of > choice, of course. The code he is writing must handle multiple requests > in parallel, thus he will be using the MultiThreadedConnectionManager. > However, he is proposing to channel all his requests through a > singleton. This is exactly how HttpClient is supposed to be used. Each thread that calls the singleton HttpClient will get it's own connection from the MTHCM (assuming the connection limits are chosen appropriately). MTHCM is internally synchronized. You only have to take care about HttpState. HttpClient holds a single default HttpState, which is also synchronized internally. If it's OK for all the threads to share one state, that's fine. Otherwise, each thread has to keep it's own HttpState and pass it to execute(). hope that helps, Roland --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
