hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roland Weber <ROLWE...@de.ibm.com>
Subject Re: WG: Connection timeout using httpclient
Date Thu, 26 Jul 2007 06:25:30 GMT
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


Mime
View raw message