Adrian Sutton wrote:
Odi,
HttpClient doesn't depend on the GC, it depends on the user telling us when the connection is no longer in use (which Eric discovered he hadn't done). There is however a fallback whereby when a HttpConnection is garbage collected (ie: when we discover that it is no longer in use), it tells the connection manager that it is no longer in use. You are right that this behavior should not be depended upon, but it is a nice fallback.

True


Also, connections release themselves when there is no more data to be read from the stream.

The solution in this case is to always call releaseConnection() when you're finished with the connection (as is mentioned lots and lots through our docs :) and I really can't see any better way to deal with it.

This is definitely the right use of the API (the one who acquires a resource is the one to release it; not taking disasters like sudden death into account here). Forgetting releaseConnection is misuse and therefore I don't care if a deadlock occurs in that situation. Are we 100% sure that a deadlock can not occur when releaseConnection is used correctly?


If someone else comes up with a way to detect that a connection (which has an unknown amount of data) is no longer in use, it would definitely be good to implement it, but I'd be surprised if there was a good way.

As we all know by now it's not possible.


Regards,

Adrian Sutton.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to