Class WeakReference<T,A>

java.lang.Object
java.lang.ref.Reference<T>
java.lang.ref.WeakReference<T>
io.smallrye.common.ref.WeakReference<T,A>
Type Parameters:
T - the reference value type
A - the attachment type
All Implemented Interfaces:
Reference<T,A>

public class WeakReference<T,A> extends WeakReference<T> implements Reference<T,A>
A reapable weak reference with an attachment. If a Reaper is given, then it will be used to asynchronously clean up the referent.
See Also:
  • Constructor Details

    • WeakReference

      public WeakReference(T referent)
      Construct a new instance.
      Parameters:
      referent - the referent
    • WeakReference

      public WeakReference(T referent, A attachment)
      Construct a new instance.
      Parameters:
      referent - the referent
      attachment - the attachment
    • WeakReference

      public WeakReference(T referent, A attachment, ReferenceQueue<? super T> q)
      Construct a new instance with an explicit reference queue.
      Parameters:
      referent - the referent
      attachment - the attachment
      q - the reference queue to use
    • WeakReference

      public WeakReference(T referent, A attachment, Reaper<T,A> reaper)
      Construct a new instance with a reaper.
      Parameters:
      referent - the referent
      attachment - the attachment
      reaper - the reaper to use
  • Method Details