hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roland Weber <http-as...@dubioso.net>
Subject Re: Handling HTTP Keep-Alives
Date Thu, 25 May 2006 06:41:26 GMT
Hello John,

> I would like to be able to tell if a connection should be kept alive or not
> (without manually having to look for the header, etc) so that
> I don't explicitly close it via a "releaseConnection()" when I've
> completed executing the http call.

You *always* have to call releaseConnection when you're done with a request!
It does *not* close the connection, it gives the connection back to the pool.
If you don't do that, the connection can never be used again, kept alive or

> To the best of my knowledge a call to "releaseConnection()" will
> cause the connection to close without regard of any Keep-Alive header values
> - please correct me if this understanding is wrong.

Your understanding is wrong. releaseConnection() will give the connection
back to the pool, for use by another request. The pool implementation,
that is the connection manager Oleg mentioned, will decide whether the
connection gets closed or is kept alive. The connection managers shipped
with HttpClient do consider Keep-Alive headers and HTTP version to make
that decision.


To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org

View raw message