hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: [HttpClient] Number of open sockets increase on session bean redeployment
Date Wed, 12 Oct 2005 10:10:20 GMT
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


Mime
View raw message