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.


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.

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.

Regards,

Adrian Sutton.

On Thursday, June 19, 2003, at 05:35 PM, Ortwin Glück wrote:

Eric Johnson wrote:
Ortwin,
It is an odd problem. Not quite a dead-lock in the traditional sense. One thread is waiting on the other, and the other is waiting for the garbage collector. It just so happens that the garbage collector will never kick in, because the first thread happens to be the AWT Event thread, so the user cannot interact with the application any further, thus no objects get allocated, and there is no reason to garbage collect. To oversimplify, Thread A depends on Thread B depends on Thread C depends (indirectly) on Thread A.

Okay, I understand now. Ugly, ugly and a hard nut to crack, really.


The problem seems to be that we rely on the GC. I think this is extremely bad. Nobody should ever rely on the GC, because it can litteraly take ages until it runs, when you have huge amounts of memory. So our queue could get *really* large and filled with stale objects.
It would be nicer if we could ask the objects in the queue directly if they are still 'usable' or if they are 'done with' and should be removed (maybe that is impossible though). I mean this weak reference stuff looks nice and elegant but it's unfortunately not very good for the cruel real world...


Any chance that we can remove this dependancy on the GC?

Odi


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



Reply via email to