On Saturday 13 December 2003 03:29, Stephen McConnell wrote:
> >a) It is possible that the finalize() of the component, or the
> >finalize() of any other object referred by the component is already
> >invoked before the finalize() of the proxy is invoked. So dispose() will
> >find itself in an abnormal situation, where some of the object are
> >already finalized, or even worst, just being concurrently finalized in
> >another thread.
>
> No - its not possible.  The proxy holds a hard reference to the
> component so the component cannot be finalized before the proxy.

If you haven't gotten the point from Daniel and Timothy, you are wrong;

Holding a strong reference guarantee nothing, only if you can guarantee 
something else is holding a strong reference to the Proxy, in which case the 
finalize() on the proxy won't be called either....


IMHO, we DO have an issue. Adding harm to the above is the fact that GC is not 
guaranteed to run, other than "prior to throwing an OutOfMemoryException", so 
typically GC is delayed much longer than necessary. Not only does these 
objects occupy memory, which is easier to accept, but they may hold external 
resources, which should be released ASAP.

Furthermore, I would say that the ServiceManager.release() should be 
"compulsory", i.e. if the the object is GCed without release() being called, 
some form of "Serious Error in Usage" should be signalled.

I wouldn't know if anything can be solved by using java.lang.ref.Reference 
classes, I am not experienced enough with them, but to me it seems they 
don't. It is still the GC that is in control of determination of whether an 
object is reachable or not, and the execution of the GC is non-deterministic.


Niclas

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

Reply via email to