Improved build.xml
[vimdoclet.git] / sample / java.lang.ref.SoftReference.txt
blobdaa67519a8b197e6f2e7a6e87f73d4a865a4c2bb
1 *java.lang.ref.SoftReference* *SoftReference* Soft reference objects, which are 
3 public class SoftReference
4   extends    |java.lang.ref.Reference|
6 |java.lang.ref.SoftReference_Description|
7 |java.lang.ref.SoftReference_Fields|
8 |java.lang.ref.SoftReference_Constructors|
9 |java.lang.ref.SoftReference_Methods|
11 ================================================================================
13 *java.lang.ref.SoftReference_Constructors*
14 |java.lang.ref.SoftReference(T)|Creates a new soft reference that refers to the
15 |java.lang.ref.SoftReference(T,ReferenceQueue)|Creates a new soft reference tha
17 *java.lang.ref.SoftReference_Methods*
18 |java.lang.ref.SoftReference.get()|Returns this reference object's referent.
20 *java.lang.ref.SoftReference_Description*
22 Soft reference objects, which are cleared at the discretion of the garbage 
23 collector in response to memory demand. Soft references are most often used to 
24 implement memory-sensitive caches. 
26 Suppose that the garbage collector determines at a certain point in time that 
27 an object is softly reachable. At that time it may choose to clear atomically 
28 all soft references to that object and all soft references to any other 
29 softly-reachable objects from which that object is reachable through a chain of 
30 strong references. At the same time or at some later time it will enqueue those 
31 newly-cleared soft references that are registered with reference queues. 
33 All soft references to softly-reachable objects are guaranteed to have been 
34 cleared before the virtual machine throws an OutOfMemoryError. Otherwise no 
35 constraints are placed upon the time at which a soft reference will be cleared 
36 or the order in which a set of such references to different objects will be 
37 cleared. Virtual machine implementations are, however, encouraged to bias 
38 against clearing recently-created or recently-used soft references. 
40 Direct instances of this class may be used to implement simple caches; this 
41 class or derived subclasses may also be used in larger data structures to 
42 implement more sophisticated caches. As long as the referent of a soft 
43 reference is strongly reachable, that is, is actually in use, the soft 
44 reference will not be cleared. Thus a sophisticated cache can, for example, 
45 prevent its most recently used entries from being discarded by keeping strong 
46 referents to those entries, leaving the remaining entries to be discarded at 
47 the discretion of the garbage collector. 
50 *java.lang.ref.SoftReference(T)*
52 public SoftReference(java.lang.Object referent)
54 Creates a new soft reference that refers to the given object. The new reference 
55 is not registered with any queue. 
57     referent - object the new soft reference will refer to 
59 *java.lang.ref.SoftReference(T,ReferenceQueue)*
61 public SoftReference(
62   java.lang.Object referent,
63   java.lang.ref.ReferenceQueue q)
65 Creates a new soft reference that refers to the given object and is registered 
66 with the given queue. 
68     referent - object the new soft reference will refer to 
69     q - the queue with which the reference is to be registered, or null if registration 
70        is not required 
72 *java.lang.ref.SoftReference.get()*
74 public |java.lang.Object| get()
76 Returns this reference object's referent. If this reference object has been 
77 cleared, either by the program or by the garbage collector, then this method 
78 returns null. 
81     Returns: The object to which this reference refers, or null if this reference object has 
82              been cleared