- java.lang.Object
-
- java.lang.ref.Reference<T>
-
- java.lang.ref.SoftReference<T>
-
public class SoftReference<T> extends Reference<T>
SoftReference objects are used to detect referents which are no longer visible and who's memory is to be reclaimed.- Since:
- 1.2
-
-
Constructor Summary
Constructors Constructor Description SoftReference(T r)
Constructs a new instance of this class.SoftReference(T r, ReferenceQueue<? super T> q)
Constructs a new instance of this class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description T
get()
Return the referent of the reference object.-
Methods declared in class java.lang.ref.Reference
clear, clone, enqueue, isEnqueued, reachabilityFence
-
-
-
-
Constructor Detail
-
SoftReference
public SoftReference(T r, ReferenceQueue<? super T> q)
Constructs a new instance of this class.- Parameters:
r
- referent to track.q
- queue to register to the reference object with.
-
SoftReference
public SoftReference(T r)
Constructs a new instance of this class.- Parameters:
r
- referent to track.
-
-