hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: Question concerning closing http-connections
Date Mon, 03 Apr 2006 09:18:55 GMT
On Mon, 2006-04-03 at 10:55 +0200, Roland Weber wrote:
> Hello Mathias,
> 
> > After executing the GetMethod with the client I fetch the responseBody 
> > via getResponseBody() and then I call closeIdleConnections() with a 
> > timeout of 15s on the corresponding HttpConnectionManger. After that I 
> > call releaseConnection() on the GetMethod-Object.
> > 
> > Question: Is the Connection that was used closed after that or does it 
> > remain open?
> 
> It remains open.
> 
> > If it remains open, how can I close it?
> 
> Several options:
> 1. send a "Connection: close" header with the request
> 2. call closeIdleConnections() *after* releasing the connection
>    and/or with a lower timeout
> 3. implement a connection manager that always closes connections
> 

Mathias,

The real question is whether this is what you really want or you just
want to make sure your app does not run out of file descriptors. If
latter is the case make sure 
(1) HttpClient instance gets reused along with its connection manager
whenever possible
(2) you periodically call HttpConnectionManager#closeIdleConnections()
to drop connections that have been idle for too long

Oleg



> hope that helps,
>   Roland
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
> 
> 


---------------------------------------------------------------------
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