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 (see `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 Summary

    Constructors
    Constructor | Description
    --- | ---
    `EnqueuedWeakReference​(T ref, ReferenceQueue<? super T> queue)` | Creates a new `EnqueuedWeakReference`.

  - ### Method Summary

    - ### Methods inherited from class java.lang.ref.Reference

      `clear, enqueue, get, isEnqueued`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### EnqueuedWeakReference

          public EnqueuedWeakReference​(T ref,
                                       @Nullable
                                       ReferenceQueue<? super T> queue)

      Creates a new `EnqueuedWeakReference`.

      The given reference can be retrieved using `Reference.get()` until the object is garbage collected. Then the method will return `null`.

      Parameters:
        `ref` - object the new weak reference will refer to
        `queue` - the queue with which the reference is to be registered