1 7 8 package java.lang.ref; 9 10 11 46 47 public class SoftReference<T> extends Reference <T> { 48 49 51 static private long clock; 52 53 57 private long timestamp; 58 59 65 public SoftReference(T referent) { 66 super(referent); 67 this.timestamp = clock; 68 } 69 70 79 public SoftReference(T referent, ReferenceQueue <? super T> q) { 80 super(referent, q); 81 this.timestamp = clock; 82 } 83 84 92 public T get() { 93 T o = super.get(); 94 if (o != null) this.timestamp = clock; 95 return o; 96 } 97 98 } 99 | Popular Tags |