I've implemented such a feature locally, but the version I'm using has
many additional changes to make HttpClient work with Java 1.1.8. Once I
find a bit of free time to incorporate the patch into CVS HEAD (is that
what you would like patches submitted against?), I will submit the patch
and offer it up for discussion as to how it can best fit in with
Michael's suggestions to use a callback-style interface with regard to
HttpConnection's various states. As is now (against 2.0rc2), much of
the existing code in MultiThreadedHttpConnectionManager is reused. I
move the majority of code in ConnectionPool.deleteLeastUsedConnection to
a new ConnectionPool.deleteConnection(HttpConnection), and added a new
ConnectionPool.deleteOldConnections(long) which iterates through through
each connection in 'freeConnections', determines if the last time it was
released is older than the parameter, and if so calls deleteConnection
on it. The last time is set in HttpConnection when releaseConnection is
called on it. This was the simplest way of implementing the feature,
and as it was something that was very useful in LimeWire, I figured the
best way is just to add it now and then collaborate to determine the
best way to permanently include it in HttpClient.
If people would like, the code is visible on our CVS servers, at
http://httpclient-118.limewire.org/servlets/ProjectSource (that page has
instructions for viewing online or downloading via anonymous CVS).
Thanks,
Sam
Oleg Kalnichevski wrote:
The only solution I can see is that perhaps HTTPClient could follow IE's
approach and close & remove free connections from the connection manager
pool after a configurable period of inactivity?
Matthew,
This sounds like a reasonable addition to HttpClient connection
management capabilities. Michael Becke & Sam Berlin have been recently
discussing such a feature and possible options of implementing it.
There's a good chance that it will eventually be added, but it may take
a while
Oleg
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]