Return-Path: Delivered-To: apmail-jakarta-httpclient-user-archive@www.apache.org Received: (qmail 28730 invoked from network); 9 Feb 2007 13:21:42 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 9 Feb 2007 13:21:42 -0000 Received: (qmail 19204 invoked by uid 500); 9 Feb 2007 13:21:48 -0000 Delivered-To: apmail-jakarta-httpclient-user-archive@jakarta.apache.org Received: (qmail 19194 invoked by uid 500); 9 Feb 2007 13:21:48 -0000 Mailing-List: contact httpclient-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: "HttpClient User Discussion" Reply-To: "HttpClient User Discussion" Delivered-To: mailing list httpclient-user@jakarta.apache.org Delivered-To: moderator for httpclient-user@jakarta.apache.org Received: (qmail 11360 invoked by uid 99); 9 Feb 2007 13:12:39 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: local policy) X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: Is this a good idea? Date: Fri, 9 Feb 2007 08:12:07 -0500 Message-ID: <19FBA0BAF7AD2F4081C0FE36832A6E8401794263@GWDC04.GuideWorks.TV> In-Reply-To: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Is this a good idea? Thread-Index: AcdMEY18W0r99RmoRfKtveW9saTpigAOhZFQ From: "Steve Terrell" To: "HttpClient User Discussion" X-Virus-Checked: Checked by ClamAV on apache.org 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:ROLWEBER@de.ibm.com]=20 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.=20 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: httpclient-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: httpclient-user-help@jakarta.apache.org