hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sam Berlin <sber...@limepeer.com>
Subject Re: Keeping Connections Alive
Date Fri, 14 Nov 2003 17:58:42 GMT
Thanks for the reply, Mike.  Is there any interest in a feature that 
would close connections that have been unused for a certain amount of 
time?  I imagine the easiest way to implement this would be to just add 
some settable parameters (set/getCloseConnectionTime) to 
MultiThreadedHttpConnectionManager along with another Thread that will 
occasionally iterate through the list of 'freeConnections' in the 
'connectionPool', checking an amount of time has lapsed since the 
connection was last marked as free.  HttpConnection (or 
HttpConnectionAdapater, since this feature would only be in 
MultiThreadedHttpConnectionManager) could have a new value added to it 
that stores the most recent time it was released.  Note that this would 
all rely on the user correctly calling 'releaseConnection', but that's 
essentially a requirement already anyway.  If people are interested in 
such a feature, I would be more than willing to write up such a patch 
(as I will probably be doing it for the version LimeWire uses anyway).

Thanks,
 Sam

Michael Becke wrote:

> Hi Sam,
>
> HttpClient does not do any active connection reclaiming, except when 
> the resources are reused.  In the case of the 
> SimpleHttpConnectionManager the connection is never closed/reopened 
> unless it is required for a new method execution.  The case for 
> MultiThreadedHttpConnectionManager is similar though a little more 
> complicated.  It keeps a pool of connections with a per-host and total 
> connection limit.  Again these connections are never closed until a 
> request for a new connection warrants it.
>
> Mike
>
> On Nov 13, 2003, at 4:10 PM, Sam Berlin wrote:
>
>> Hi All,
>>
>> I'd like to clarify a point about HttpClient that I do not fully 
>> understand.  How/when does the actual connection to a server close?  
>> I understand that MultiThreadedHttpConnectionManager (and possibly 
>> SimpleConnectionManager as well) will keep the connection alive and 
>> reuse it for subsequent HTTP requests.  Is there a way to set a limit 
>> on how long the connection should be kept alive before waiting for a 
>> subsequent request to reuse that connection?
>>
>> Thanks,
>> Sam
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: 
>> commons-httpclient-dev-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: 
>> commons-httpclient-dev-help@jakarta.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: 
> commons-httpclient-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: 
> commons-httpclient-dev-help@jakarta.apache.org
>
>
> .
>



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


Mime
View raw message