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:                                     
       <[EMAIL PROTECTED]>         "HttpClient User Discussion"      
                                     <[email protected]>
                                                                       
 Vom:  26.07.2007 08:25                                                
       Bitte antworten an                                              
       "HttpClient User                                                
       Discussion"                                                     
                                                                       
                                                                       





Thema:      Re: WG: Connection timeout using httpclient [*]




[EMAIL PROTECTED] 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to