Hi,

While reading about re-defining the finalize() method explicitly in a class I 
came across some statements and like to get some clarification from the experts.

On http://www.fasterj.com/articles/finalizer2.shtml, the author states that 
"the GC adds each of those Finalizer objects to the reference queue at 
java.lang.ref.Finalizer.ReferenceQueue.". Based on this the Finalizer object 
associated with the finalizeable object goes on the reference queue.

On page 311 of book Service-Oriented Computing - ICSOC 2011 
Workshops<https://books.google.com/books?id=hIa5BQAAQBAJ&pg=PA311&lpg=PA311&dq=java,+finalization+queue&source=bl&ots=LLGiYGWh0L&sig=Glvf0kn0zKHrdWoPzM6y6wtsr_M&hl=en&sa=X&ved=0ahUKEwjHrsL2pdPPAhUk3IMKHdXRCtc4ChDoAQgbMAA#v=onepage&q=finalization%20queue&f=false>
 "... all those objects that have a finalize () method and are found to be 
unreachable(dead) by garbage collector, are pushed into a finalization queue.". 
So the finalizeable object goes on the finalization queue.

Then this site, https://yourkit.com/forum/viewtopic.php?f=3&t=4672, states that 
"Objects of all classes with redefined finalize() method are added to a queue 
at the moment of creation. The queue head is referenced from a static field in 
java.lang.ref.Finalizer. An instance of Finalizer is created for each 
"finalizeable" object and is stored in that queue, which is in fact a linked 
list of Finalizers.", so both the finalizeable object and the associated 
Finalizer object are stored in the same queue?

So my questions are: Are there one or two queues involved? Exactly how object 
finalization works?


Appreciate your input,
Jun

Jun Zhuang
Sr. Performance QA Engineer | 
Hobsons<https://www.hobsons.com/?utm_source=outlook&utm_medium=email&utm_campaign=banner_02.12.16_general>
T: +1 513 746 2288 | jun.zhu...@hobsons.com
50 E-Business Way, Suite 300 | Cincinnati, OH 45241 | USA


Upgraded by Hobsons - Subscribe Today
_______________________________________________
hotspot-gc-use mailing list
hotspot-gc-use@openjdk.java.net
http://mail.openjdk.java.net/mailman/listinfo/hotspot-gc-use

Reply via email to