hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lars George <l...@worldlingo.com>
Subject Re: WG: Connection timeout using httpclient [*]
Date Mon, 30 Jul 2007 21:31:44 GMT
Hi Guys,

I had the same issue - glad you brought this up, I always wondered why we had so many lingering

connections to the Squid proxy we use. I had to add two headers actually:

   Connection: close
   Proxy-Connection: close

Obviously because of our proxy use internally. Now they get ramped down as expect. Smooth!

HTH,
Lars

Markus.Gierich@fiducia.de wrote:
> Hello Roland,
> 
> I want to use a connection pool. How can I remove closed connections from the
> pool ? As you wrote, the method.releaseConnection() only frees the connection
> for reuse. Do you see my point ?
> 
> Markus
> 
> 
>  MultiThreadedHttpConnectionManager connectionManager = new
> MultiThreadedHttpConnectionManager();
>                 HttpClient client = new HttpClient(connectionManager);
> 
>                 // Create a method instance.
>                 GetMethod method = new GetMethod(url);
>               method.releaseConnection();
> 
> 
>                                ------------------------------------------------ 
>        de.ibm.com                                                               
>                                                                                 
>                                                                                 
>                                                                                 
>  Von:  Roland Weber            An:                                              
>        <ROLWEBER@de.ibm.com>         "HttpClient User Discussion"             
 
>                                      <httpclient-user@jakarta.apache.org>     
 
>                                                                                 
>  Vom:  26.07.2007 08:25                                                         
>        Bitte antworten an                                                       
>        "HttpClient User                                                         
>        Discussion"                                                              
>                                                                                 
>                                                                                 
> 
> 
> 
> 
> 
> Thema:      Re: WG: Connection timeout using httpclient [*]
> 
> 
> 
> 
> Markus.Gierich@fiducia.de wrote on 26.07.2007 08:16:42:
>> After sent a sms I close the connection via method.releaseConnection().
> If I
>> don't send a sms for more than 2 hours and then the next sms I get
> aconnection
>> timeout. But after that, the 2 second sms works again. Does
> releaseConnection
>> really close the connection ?
> 
> No, it doesn't. releaseConnection releases the connection back to
> the connection pool, where it is kept open for re-use. You can
> either disable connection re-use altogether, for example by sending
> "Connection: close" headers with the requests, or you can call the
> method closeIdleConnections(...) on the connection pool to close
> only the connections that have been open and idle for a given
> timespan. It depends on the requency of your requests whether
> connection keep-alive is a performance improvement or not.
> 
> http://jakarta.apache.org/commons/httpclient/performance.html#Connection_persistence
> 
> http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/httpclient/HttpConnectionManager.html#closeIdleConnections(long)
> 
> 
> cheers,
>   Roland
> 
> 
> 
> 
> 
> ----------------------------------------------------------------------------------------------------------------------------------------------
> 
> FIDUCIA IT AG
> Fiduciastra├če 20
> 76227 Karlsruhe
> 
> Sitz der Gesellschaft: Karlsruhe
> AG Mannheim HRB 100059
> 
> Vorsitzender des Aufsichtsrats: Erwin Kuhn
> Vorsitzender des Vorstands: Michael Krings
> Vorstand: Klaus-Peter Bruns, Hans-Peter Straberger, Eckhardt Werner
> 
> Umsatzsteuer-ID.Nr. DE143582320, http://www.fiducia.de
> ----------------------------------------------------------------------------------------------------------------------------------------------
> 
> 
> 
> ---------------------------------------------------------------------
> 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