jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From un...@apache.org
Subject svn commit: r1737832 - /jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/LocalCache.java
Date Tue, 05 Apr 2016 12:52:41 GMT
Author: unico
Date: Tue Apr  5 12:52:41 2016
New Revision: 1737832

URL: http://svn.apache.org/viewvc?rev=1737832&view=rev
Log:
JCR-3958 skip entries that cannot be removed

Modified:
    jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/LocalCache.java

Modified: jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/LocalCache.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/LocalCache.java?rev=1737832&r1=1737831&r2=1737832&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/LocalCache.java
(original)
+++ jackrabbit/trunk/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/LocalCache.java
Tue Apr  5 12:52:41 2016
@@ -564,13 +564,20 @@ public class LocalCache {
                     for (String fileName : new ArrayList<String>(toBeDeleted)) {
                         cache.remove(fileName);
                     }
+                    int skipCount = 0;
                     Iterator<Map.Entry<String, Long>> itr = cache.entrySet().iterator();
                     while (itr.hasNext()) {
                         Map.Entry<String, Long> entry = itr.next();
                         if (entry.getKey() != null) {
                             if (cache.currentSizeInBytes > cache.cachePurgeResize) {
-                                cache.remove(entry.getKey());
-                                itr = cache.entrySet().iterator();
+                                if (cache.remove(entry.getKey()) != null) {
+                                    itr = cache.entrySet().iterator();
+                                    for (int i = 0; i < skipCount && itr.hasNext();
i++) {
+                                        itr.next();
+                                    }
+                                } else {
+                                    skipCount++;
+                                }
                             } else {
                                 break;
                             }



Mime
View raw message