Author: michiel
Date: 2009-06-25 22:18:26 +0200 (Thu, 25 Jun 2009)
New Revision: 36432

Modified:
   mmbase/trunk/core/src/main/java/org/mmbase/cache/implementation/LRUCache.java
Log:
some other details

Modified: 
mmbase/trunk/core/src/main/java/org/mmbase/cache/implementation/LRUCache.java
===================================================================
--- 
mmbase/trunk/core/src/main/java/org/mmbase/cache/implementation/LRUCache.java   
    2009-06-25 20:15:52 UTC (rev 36431)
+++ 
mmbase/trunk/core/src/main/java/org/mmbase/cache/implementation/LRUCache.java   
    2009-06-25 20:18:26 UTC (rev 36432)
@@ -46,9 +46,8 @@
                 } else if (overSized == 1) {
                     // Using iterator to manualy remove the eldest rather then 
return true to make absolutely sure that one
                     // disappears, because that seems to fail sometimes for 
QueryResultCache.
-                    // The assertions are ment to detect the odd situations 
where this would have happened.
 
-                    Iterator<K> i = keySet().iterator();
+                    final Iterator<K> i = keySet().iterator();
                     K actualEldest = i.next();
                     i.remove();
                     overSized = size() - LRUCache.this.maxSize;
@@ -56,7 +55,7 @@
                         // if for some reason a key changed in the cache, even 
1 i.remove may not
                         // shrink the cache.
                         log.warn("cache didn't shrink " + eldest + " = " + 
actualEldest);
-                        i.next();
+                        actualEldest = i.next();
                         i.remove();
                         overSized = size() - LRUCache.this.maxSize;
                     }
@@ -67,7 +66,7 @@
                     log.debug("because", new Exception());
                     if (overSized > 10) {
                         log.error("For some reason this cache grew much too 
big (" + size() + " >> " + LRUCache.this.maxSize + "). This must be some kind 
of bug. Resizing now.");
-                        LRUCache.this.setMaxSize(LRUCache.this.maxSize);
+                        clear();
                     }
                     return false;
                 }

_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to