> From: Oleg Kalnichevski <[email protected]> > Date: February 20, 2010 3:47:55 AM PST > To: HttpClient User Discussion <[email protected]> > Subject: Re: Maximum connection lifetime? > > > Matt Solnit wrote: >> Hi everyone. Using HttpClient 4.0.1, is it possible to set a maximum >> overall lifetime for pooled (persistent) connections? I looked at >> implementing ConnectionKeepAliveStrategy, but I believe this is invoked for >> every request, so there is no way to "remember" when a connection was >> initially opened.
> Hi Matt > > Currently idle time counter gets reset after each lease/release of a > persistent connection, and there is not way to change this behavior > without writing a new connection manager. The good news is that the idle > connection handling logic is encapsulated in one class, which could be > replaced with a pluggable strategy. > > http://hc.apache.org/httpcomponents-client/httpclient/xref/org/apache/http/impl/conn/IdleConnectionHandler.html > > Another possibility may be to make connection creation time available > through the HttpConnectionMetrics interface: > > http://hc.apache.org/httpcomponents-core/httpcore/apidocs/org/apache/http/HttpConnection.html#getMetrics%28%29 > > > > Hope this helps > > Oleg Thanks for your quick response! I'll be sure to report back to let you know how it worked out. -- Matt --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
