jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From un...@apache.org
Subject svn commit: r1738734 - /jackrabbit/branches/2.12/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/LocalCache.java
Date Tue, 12 Apr 2016 08:40:58 GMT
Author: unico
Date: Tue Apr 12 08:40:58 2016
New Revision: 1738734

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

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

Modified: jackrabbit/branches/2.12/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/LocalCache.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.12/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/LocalCache.java?rev=1738734&r1=1738733&r2=1738734&view=diff
==============================================================================
--- jackrabbit/branches/2.12/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/LocalCache.java
(original)
+++ jackrabbit/branches/2.12/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/LocalCache.java
Tue Apr 12 08:40:58 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