On Thu, 2007-06-21 at 10:18 +0300, Tankelevich Leonid wrote: > Hello team, > > As I understood, physical connection remains open (and may be reused for > the next request) during some time after response to a HTTP 1.1 request. > Is this duration controlled by server or client? > How may I manage it with HttpClient? >
The HTTP spec does not prescribe how long a persistent connection may be kept alive. Essentially a persistent connection can be closed by either client or server at any time of their choosing. HttpClient keeps persistent connections alive infinitely per default. One can implement a custom connection eviction policy by using #closeIdleConnections method of the HttpConnectionManager interface. There is also a utility class called IdleConnectionTimeoutThread [2] which can be used to start a background thread to periodically invoke #closeIdleConnections() on connection manager instances registered with the thread. Hope this helps Oleg [1] http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/httpclient/HttpConnectionManager.html#closeIdleConnections(long) [2] http://jakarta.apache.org/commons/httpclient/apidocs/org/apache/commons/httpclient/util/IdleConnectionTimeoutThread.html > Thanks, > Leonid Tankelevich > Comverse Ltd. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
