--- a/jdk/src/share/classes/java/lang/ref/SoftReference.java Thu Apr 02 11:13:56 2009 +0100
+++ b/jdk/src/share/classes/java/lang/ref/SoftReference.java Thu Apr 02 11:19:34 2009 +0100
@@ -63,11 +63,13 @@
public class SoftReference<T> extends Reference<T> {
- /* Timestamp clock, updated by the garbage collector
+ /**
+ * Timestamp clock, updated by the garbage collector
*/
static private long clock;
- /* Timestamp updated by each invocation of the get method. The VM may use
+ /**
+ * Timestamp updated by each invocation of the get method. The VM may use
* this field when selecting soft references to be cleared, but it is not
* required to do so.
*/
@@ -108,7 +110,8 @@
*/
public T get() {
T o = super.get();
- if (o != null) this.timestamp = clock;
+ if (o != null && this.timestamp != clock)
+ this.timestamp = clock;
return o;
}