jdk/src/share/classes/java/lang/ref/SoftReference.java
changeset 2442 f8bb207f9458
parent 2 90ce3da70b43
child 5506 202f599c92aa
--- 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;
     }