It seems tricky to write correct finalizers in Java, but seems not tricky to implement a correct finalizer in JVM. There are some new sections in JLS (or JSR133) on the interactions of finalizer and Java memory model. In my understanding, a correct JVM finalizer can be achieved with following conditions: 1) have finalizer run in a seperate thread; 2) guarantee a global barrier before the finalizer queue is executed (can be implicitly done by GC); and, 3) finish it before next GC cycle (or reachability decision point).
How do you folks think? Thanks, xiaofeng == Intel Managed Runtime Division
