java.lang.ref
Class SoftReference
java.lang.Object
|
+--java.lang.ref.Reference
|
+--java.lang.ref.SoftReference
A soft reference will be cleared, if the object is only softly
reachable and the garbage collection needs more memory. The garbage
collection will use an intelligent strategy to determine which soft
references it should clear. This makes a soft reference ideal for
caches.
Author:SoftReference
public SoftReference(java.lang.Object referent)
Create a new soft reference, that is not registered to any queue.
Parameters:
SoftReference
public SoftReference(java.lang.Object referent, java.lang.ref.ReferenceQueue q)
Create a new soft reference.
Parameters:
Throws:
get
public Object get()
Returns the object, this reference refers to.
Returns:
- the object, this reference refers to, or null if the
reference was cleared.