All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----java.lang.ref.Reference | +----java.lang.ref.PhantomReference
A phantom reference is a reference object that remains valid even after the collector determines that its referent may be reclaimed. If a phantom reference is registered and the garbage collector determines at a certain point in time that its referent is no longer strongly reachable, has no guarded or weak references, and has been finalized, then at some later time the collector will enqueue the reference.
In order to ensure that a reclaimable object remains so, the referent of
a phantom reference may not be retrieved: The get
method of a
phantom reference always returns null
.
null
, since the referent of a phantom reference
is always inaccessible.
public PhantomReference(Object referent)
public PhantomReference(Object referent, ReferenceQueue q)
queue
argument
is null
public Object get()
null
, since the referent of a phantom reference
is always inaccessible.
All Packages Class Hierarchy This Package Previous Next Index