public class EnqueuedWeakReference
extends java.lang.ref.WeakReference
Reference.get()
) is set to null
by
the system. A typical use is to subclass EnqueuedWeakReference
with classes that
hold native handles that need to be freed at the native level.Constructor and Description |
---|
EnqueuedWeakReference(java.lang.Object ref,
ReferenceQueue queue)
Creates a new
EnqueuedWeakReference .The given reference can be retrieved using Reference.get() until the object is garbage
collected. |
public EnqueuedWeakReference(java.lang.Object ref, ReferenceQueue queue)
EnqueuedWeakReference
.Reference.get()
until the object is garbage
collected. Then the method will return null
.ref
- object the new weak reference will refer toqueue
- the queue with which the reference is to be registered