aicas logoJamaica 3.2 release 62

java.lang.ref
Class PhantomReference<T>

java.lang.Object
  extended by java.lang.ref.Reference<T>
      extended by 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

Constructor Summary
PhantomReference(T r, ReferenceQueue<? super T> q)
          Initialize this phantome reference instance.
 
Method Summary
 T get()
          For phantom references, get() always returns null.
 
Methods inherited from class java.lang.ref.Reference
clear, enqueue, finalize, isEnqueued
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

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.
Method Detail

get

public T get()
For phantom references, get() always returns null.

Overrides:
get in class Reference<T>
Returns:
null.

aicas logoJamaica 3.2 release 62

aicas GmbH, Karlsruhe - Germany    www.aicas.com
Copyright 2001-2008 aicas GmbH. All Rights Reserved.