commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: [httpclient] CLOSE_WAIT sticking around
Date Tue, 15 Nov 2005 23:24:10 GMT
On Tue, 2005-11-15 at 17:22 -0500, Mark Diggory wrote:
> Oleg Kalnichevski wrote:
> 
> >On Tue, 2005-11-15 at 16:23 -0500, Mark Diggory wrote:
> >  
> >
> >>I'm getting a number of CLOSE_WAIT sockets between HttpClient and my 
> >>Apache server. Do you know how I can configure HttpClient not to leave 
> >>behind CLOSE_WAIT's?
> >>
> >>    
> >>
> >
> >Mark,
> >
> >Consider implementing an idle connection handler
> >
> >For details see
> >
> >http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/httpclient/HttpConnectionManager.html#closeIdleConnections(long)
> >http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/httpclient/util/IdleConnectionTimeoutThread.html
> >
> >Hope this helps
> >
> >Oleg
> >  
> >
> 
> Ok, That seems logical, I have another consideration that may change 
> your recommendation, I'm using MultithreadedConnectionManager and I'm 
> starting to be less interested reusing connections and just let them go 
> away between requests. It tends to be the case that the requests are 
> neither long lived nor numerous per HttpClient, I can live with the 
> overhead of reconnecting if it means resources stay free between. How do 
> I tune the client to accomplish this?
> 

Just extend the MultithreadedConnectionManager, override the
releaseConnection method and always close the connection you get as a
parameter

http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/httpclient/MultiThreadedHttpConnectionManager.html#releaseConnection(org.apache.commons.httpclient.HttpConnection)

Hope this helps

Oleg

> thanks,
> Mark


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message