Jonathan Hawkes wrote:
If I am not mistaken, finalization order is not guaranteed by the VM.
Therefore, in the case of a circular reference, you really can't know
whether the finalize method will be called on "a" or "b" first.
Yep - sounds right.
But then, who really cares?
I'm thinking the same thing.
My point is this. All references that are reachable by a particular object ARE STILL reachable to that object when its finalize() method is called. How else would finalize be useful to perform cleanup operations? Objects are discarded some time after finalize(). But there is a guarantee. Before an object is discarded, any object that references that object will have its finalize() method invoked.
I agree - but I also think that there is a valid issue concerning a potential for non-finalization of an object on JVM termination. The spec states "best-effort" implied by the limitations/constraints implied on the JVM by the underlying OS. In particular the OSM may kill the JVM instance before it completes finalization processing. In such a scenario we could see a situation where a component or components are not fully decommissioned - however - I would argue that this is largely academic - bacause in reality we are talking about JVM termination during which we are decommmissioning the kernel and are subject to the exact same limitations - i.e. merlin can assure that it will aply best efforts to cleanup itself subject to the restrictions imposed by the OS. And in reality - you test and parameterize this as necessary (for example - an NT service can be configured with startup and shutdown delay limits).
Stephen.
--
Stephen J. McConnell mailto:[EMAIL PROTECTED]
|------------------------------------------------| | Magic by Merlin | | Production by Avalon | | | | http://avalon.apache.org/merlin | | http://dpml.net/ | |------------------------------------------------|
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
