Commits

chri...@81dbac14-341a-0410-aa85-cbcd92e6f43e  committed a690bec

The suggested fix for [CACHE-44] did not quite go far enough

  • Participants
  • Parent commits 64d6424

Comments (0)

Files changed (1)

File src/core/java/com/opensymphony/oscache/base/algorithm/LRUCache.java

      */
     protected void itemPut(Object key) {
         // Since this entry was just accessed, move it to the back of the list.
-        // No need to sync here because AbstractConcurrentReadCache only allows
-        // one put to occur at a time.
         if (isMap) {
-            map.remove(key);
-            map.put(key, Boolean.TRUE);
+            synchronized (map) {             // A further fix for CACHE-44
+                map.remove(key);
+                map.put(key, Boolean.TRUE);
+            }
         } else {
-            list.remove(key);
-            list.add(key);
+            synchronized (list) {            // A further fix for CACHE-44
+                list.remove(key);
+                list.add(key);
+            }
         }
     }