1 *java.lang.ref.PhantomReference* *PhantomReference* Phantom reference objects, w
3 public class PhantomReference<T>
4 extends |java.lang.ref.Reference|
6 |java.lang.ref.PhantomReference_Description|
7 |java.lang.ref.PhantomReference_Fields|
8 |java.lang.ref.PhantomReference_Constructors|
9 |java.lang.ref.PhantomReference_Methods|
11 ================================================================================
13 *java.lang.ref.PhantomReference_Constructors*
14 |java.lang.ref.PhantomReference(T,ReferenceQueue<?superT>)|Creates a new phanto
16 *java.lang.ref.PhantomReference_Methods*
17 |java.lang.ref.PhantomReference.get()|Returns this reference object's referent.
19 *java.lang.ref.PhantomReference_Description*
21 Phantom reference objects, which are enqueued after the collector determines
22 that their referents may otherwise be reclaimed. Phantom references are most
23 often used for scheduling pre-mortem cleanup actions in a more flexible way
24 than is possible with the Java finalization mechanism.
26 If the garbage collector determines at a certain point in time that the
27 referent of a phantom reference is phantom reachable, then at that time or at
28 some later time it will enqueue the reference.
30 In order to ensure that a reclaimable object remains so, the referent of a
31 phantom reference may not be retrieved: The get method of a phantom reference
34 Unlike soft and weak references, phantom references are not automatically
35 cleared by the garbage collector as they are enqueued. An object that is
36 reachable via phantom references will remain so until all such references are
37 cleared or themselves become unreachable.
41 *java.lang.ref.PhantomReference(T,ReferenceQueue<?superT>)*
43 public PhantomReference(
45 java.lang.ref.ReferenceQueue<? super T> q)
47 Creates a new phantom reference that refers to the given object and is
48 registered with the given queue.
50 It is possible to create a phantom reference with a null queue, but such a
51 reference is completely useless: Its get method will always return null and,
52 since it does not have a queue, it will never be enqueued.
54 referent - the object the new phantom reference will refer to
55 q - the queue with which the reference is to be registered, or null if registration
58 *java.lang.ref.PhantomReference.get()*
62 Returns this reference object's referent. Because the referent of a phantom
63 reference is always inaccessible, this method always returns null.