Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

LRUCache impl synchronizes on the map, not the cache

Yonik Seeleya7cda85584a9
diff --git a/src/java/org/apache/solr/search/LRUCache.java b/src/java/org/apache/solr/search/LRUCache.java
index 26e76a791f0..9794a21e6c7 100644
--- a/src/java/org/apache/solr/search/LRUCache.java
+++ b/src/java/org/apache/solr/search/LRUCache.java
@@ -113,12 +113,12 @@ public class LRUCache implements SolrCache {
}
}
- public synchronized Object put(Object key, Object value) {
- if (state == State.LIVE) {
- stats.inserts.incrementAndGet();
- }
-
+ public Object put(Object key, Object value) {
synchronized (map) {
+ if (state == State.LIVE) {
+ stats.inserts.incrementAndGet();
+ }
+
// increment local inserts regardless of state???
// it does make it more consistent with the current size...
inserts++;