Package ej.bon
Class EnqueuedWeakReference<T>
- java.lang.Object
-
- java.lang.ref.Reference<T>
-
- java.lang.ref.WeakReference<T>
-
- ej.bon.EnqueuedWeakReference<T>
-
- Type Parameters:
T- the type of enqueued objects
public class EnqueuedWeakReference<T> extends WeakReference<T>
EnqueuedWeakReference are objects that are queued in an ReferenceQueue by the system when the object they point at (seeReference.get()) is set tonullby the system. A typical use is to subclassEnqueuedWeakReferencewith classes that hold native handles that need to be freed at the native level.
-
-
Constructor Summary
Constructors Constructor Description EnqueuedWeakReference(T ref, ReferenceQueue<? super T> queue)Creates a newEnqueuedWeakReference.
-
-
-
Constructor Detail
-
EnqueuedWeakReference
public EnqueuedWeakReference(T ref, @Nullable ReferenceQueue<? super T> queue)
Creates a newEnqueuedWeakReference.The given reference can be retrieved using
Reference.get()until the object is garbage collected. Then the method will returnnull.- Parameters:
ref- object the new weak reference will refer toqueue- the queue with which the reference is to be registered
-
-