jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From un...@apache.org
Subject svn commit: r1738242 - /jackrabbit/branches/2.10/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/LocalCache.java
Date Fri, 08 Apr 2016 13:02:13 GMT
Author: unico
Date: Fri Apr  8 13:02:12 2016
New Revision: 1738242

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

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

Modified: jackrabbit/branches/2.10/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/LocalCache.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.10/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/LocalCache.java?rev=1738242&r1=1738241&r2=1738242&view=diff
==============================================================================
--- jackrabbit/branches/2.10/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/LocalCache.java
(original)
+++ jackrabbit/branches/2.10/jackrabbit-data/src/main/java/org/apache/jackrabbit/core/data/LocalCache.java
Fri Apr  8 13:02:12 2016
@@ -549,13 +549,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