java.lang.ref
Class PhantomReference<T>
java.lang.Object
java.lang.ref.Reference<T>
java.lang.ref.PhantomReference<T>
public class PhantomReference<T>
- extends Reference<T>
PhantomReference is a reference that will get enqueued by the
garbage collector when the referenced object is not reachable any
longer and it cannot be resurrected again (in contrast to soft and
weak references that can be resurrected by the execution of the
finalizer after these references are cleared).
In JamaicaVM, phantom references are cleared by the finalizer
thread or by any other thread calling
- Since:
- 1.2
|
Method Summary |
T |
get()
For phantom references, get() always returns null. |
PhantomReference
public PhantomReference(T r,
ReferenceQueue<? super T> q)
- Initialize this phantome reference instance.
- Parameters:
r - the object referenced by this reference.q - the reference queue to add this reference to when it is
enqueued, null for none (which would be useless here since the
only effect a phantom reference has is that it will be enqueued
when the object is unreachable).
- Throws:
InternalError - for JamaicaVM: if r is allocated in ScopedMemory.
get
public T get()
- For phantom references, get() always returns null.
- Overrides:
get in class Reference<T>
- Returns:
- null.
aicas GmbH, Karlsruhe - Germany www.aicas.com
Copyright 2001-2008 aicas GmbH. All Rights Reserved.