I think the error you make here is in this part:
Link to the finalizer from the "incomplete" linked list belonging to the Finalizer stream. My object takes 3rd place in the queue.
If you talk about it:
static private Finalizer unfinalized = null;
in Sun Finalizer.java (a Finalizer contains a next and prev Finalizer , therefore, part of the βlinked listβ for those who play at home), then this is not a list of things to be completed.
Finalizer.add() not (as I think you assume) called during the finalization process when the object is unavailable; rather, this method is called during object creation (for example, during <init> , using native code for any object that overrides finalize() .
The presence of Finalizer in the next chain does not mean that it should be completed; this is
static private ReferenceQueue queue
which contains such objects. Being in a linked list means that it has a finalize() method.
Therefore, your first point is a red herring, your second point, which keeps the element accessible, and the third point flows from the second (because WeakReference will not be cleared until the object is reached).
Hope this helps!
Cowan source share