From a7cda85584a9fc3853a6189e672772c490fe319f Mon Sep 17 00:00:00 2001 From: Yonik Seeley Date: Thu, 31 Jul 2008 18:59:52 +0000 Subject: [PATCH] LRUCache impl synchronizes on the map, not the cache git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@681440 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/solr/search/LRUCache.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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++;