hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Markus.Gier...@fiducia.de
Subject Antwort: Re: WG: Connection timeout using httpclient [*]
Date Fri, 27 Jul 2007 06:11:56 GMT
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


Mime
View raw message