Package io.smallrye.common.ref
Class SoftReference<T,A>
- java.lang.Object
-
- java.lang.ref.Reference<T>
-
- java.lang.ref.SoftReference<T>
-
- io.smallrye.common.ref.SoftReference<T,A>
-
- Type Parameters:
T- the reference value typeA- the attachment type
- All Implemented Interfaces:
Reference<T,A>
public class SoftReference<T,A> extends SoftReference<T> implements Reference<T,A>
A reapable soft reference with an attachment. If aReaperis given, then it will be used to asynchronously clean up the referent.- See Also:
SoftReference
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface io.smallrye.common.ref.Reference
Reference.Type
-
-
Constructor Summary
Constructors Constructor Description SoftReference(T referent)Construct a new instance.SoftReference(T referent, A attachment)Construct a new instance.SoftReference(T referent, A attachment, Reaper<T,A> reaper)Construct a new instance with a reaper.SoftReference(T referent, A attachment, ReferenceQueue<? super T> q)Construct a new instance with an explicit reference queue.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AgetAttachment()Get the attachment, if any.Reaper<T,A>getReaper()Reference.TypegetType()Get the type of the reference.StringtoString()-
Methods inherited from class java.lang.ref.SoftReference
get
-
Methods inherited from class java.lang.ref.Reference
clear, clone, enqueue, isEnqueued, reachabilityFence
-
-
-
-
Constructor Detail
-
SoftReference
public SoftReference(T referent)
Construct a new instance.- Parameters:
referent- the referent
-
SoftReference
public SoftReference(T referent, A attachment)
Construct a new instance.- Parameters:
referent- the referentattachment- the attachment
-
SoftReference
public SoftReference(T referent, A attachment, ReferenceQueue<? super T> q)
Construct a new instance with an explicit reference queue.- Parameters:
referent- the referentattachment- the attachmentq- the reference queue to use
-
-
Method Detail
-
getAttachment
public A getAttachment()
Description copied from interface:ReferenceGet the attachment, if any.- Specified by:
getAttachmentin interfaceReference<T,A>- Returns:
- the attachment
-
getType
public Reference.Type getType()
Description copied from interface:ReferenceGet the type of the reference.
-
-