T
- the type of enqueued objectspublic class EnqueuedWeakReference<T> extends WeakReference<T>
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(T ref,
ReferenceQueue<? super T> queue)
Creates a new
EnqueuedWeakReference . |
public EnqueuedWeakReference(T ref, @Nullable ReferenceQueue<? super T> queue)
EnqueuedWeakReference
.
The given reference can be retrieved using 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