Return-Path: Delivered-To: apmail-jakarta-httpclient-user-archive@www.apache.org Received: (qmail 24601 invoked from network); 25 Oct 2005 20:01:54 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 25 Oct 2005 20:01:54 -0000 Received: (qmail 84793 invoked by uid 500); 25 Oct 2005 20:01:53 -0000 Delivered-To: apmail-jakarta-httpclient-user-archive@jakarta.apache.org Received: (qmail 84777 invoked by uid 500); 25 Oct 2005 20:01:53 -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 Received: (qmail 84764 invoked by uid 99); 25 Oct 2005 20:01:52 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Oct 2005 13:01:52 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (asf.osuosl.org: local policy) Received: from [195.186.18.63] (HELO mail15.bluewin.ch) (195.186.18.63) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Oct 2005 13:01:50 -0700 Received: from [192.168.0.4] (83.76.228.128) by mail15.bluewin.ch (Bluewin 7.2.068.1) id 435DFF4B0002322D for httpclient-user@jakarta.apache.org; Tue, 25 Oct 2005 20:01:30 +0000 Subject: RE: [HttpClient] Number of open sockets increase on session bean redeployment From: Oleg Kalnichevski To: HttpClient User Discussion In-Reply-To: References: Content-Type: text/plain Date: Tue, 25 Oct 2005 22:01:30 +0200 Message-Id: <1130270490.4834.2.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 (2.2.3-2.fc4) Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N On Tue, 2005-10-25 at 11:24 -0400, Tom Zaranek wrote: > Thanks, the shutdown did the trick on ejbRemove. The sockets will close > under 2 or so minutes on application termination - this is good enough. > > Not sure about the threading issue. It reminds me of the fact that one > should not access the file system from EJBs but I violate that rule too. > For now it will have to do. > > Thanks for your time. > > Tom > Here's my piece of advise: wrap an instance of HttpClient with a single-treaded connection manager into a stateless session bean and let the EJB container do synchronization and pooling for you. Oleg > > -----Original Message----- > From: Oleg Kalnichevski [mailto:olegk@apache.org] > Sent: October 12, 2005 6:10 AM > To: httpclient-user@jakarta.apache.org > Subject: Re: [HttpClient] Number of open sockets increase on session > bean redeployment > > > On Tue, Oct 11, 2005 at 04:57:41PM -0400, Tom Zaranek wrote: > > I am using the MultiThreadedHttpConnectionManager, reuse HttpClient > > and do a releaseConnection() on POST method complete on finally in a > > try-catch-finally block from within a stateless session EJB. When > > reading the response sent by the post method, I > > getResponseBodyAsString(). > > > > It appears that the number of sockets opens up to the > > MAX_SOCKETS_PER_HOST_CONNECTIONS given high enough load. When I > > redeploy the application (ear file), however, the sockets stay open > > and additional MAX_SOCKETS_PER_HOST_CONNECTIONS will be created under > > the same load. If the application server gets restarted, all of the > > socket connections will be dropped. Note that the connections > > initially opened should stay open since they are set to persist. But > > on redeployment I would expect that the previously opened sockets > > would close. > > > > Can someone explain/give a solution to stop the increase of the number > > > of sockets after each redeployment? It almost appears that the > > Connection Manager does not get destroyed on application redepolyment > > which I wonder that it makes sense. Any help would be appreciated. > > > > Tom > > > > Tom, > > First off, you SHOULD not be using MultiThreadedHttpConnectionManager in > EJBs because EJBs MAY not create and manage threads [1] > > If you are absolutely sure you have to violate EJB restrictions, > please make sure you call MultiThreadedHttpConnectionManager#shutdown > on application shutdown to ensure that all active connections are > closed > > Hope this helps, > > Oleg > > [1] http://java.sun.com/blueprints/qanda/ejb_tier/restrictions.html > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org > > For additional commands, e-mail: > > httpclient-user-help@jakarta.apache.org > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: httpclient-user-help@jakarta.apache.org > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: httpclient-user-help@jakarta.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: httpclient-user-help@jakarta.apache.org