From a5c8d6b7a5c8f61407c09c181b250a39a6c36d20 Mon Sep 17 00:00:00 2001 From: Shalin Shekhar Mangar Date: Thu, 1 May 2014 07:39:39 +0000 Subject: [PATCH] SOLR-6030: Use System.nanoTime() instead of currentTimeInMills() in LRUCache.warm git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1591555 13f79535-47bb-0310-9956-ffa450edef68 --- solr/CHANGES.txt | 3 +++ solr/core/src/java/org/apache/solr/search/LRUCache.java | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index ab1f3ee2592..4450f474b35 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -123,6 +123,9 @@ Bug Fixes * SOLR-6029: CollapsingQParserPlugin throws ArrayIndexOutOfBoundsException if elevated doc has been deleted from a segment. (Greg Harris, Joel Bernstein) +* SOLR-6030: Use System.nanoTime() instead of currentTimeInMills() in LRUCache.warm. + (Tomás Fernández Löbbe via shalin) + Other Changes --------------------- diff --git a/solr/core/src/java/org/apache/solr/search/LRUCache.java b/solr/core/src/java/org/apache/solr/search/LRUCache.java index ad1ae363a8c..0219f388a7b 100644 --- a/solr/core/src/java/org/apache/solr/search/LRUCache.java +++ b/solr/core/src/java/org/apache/solr/search/LRUCache.java @@ -20,6 +20,7 @@ package org.apache.solr.search; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.Map; +import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicLong; import org.apache.solr.common.SolrException; @@ -151,7 +152,7 @@ public class LRUCache extends SolrCacheBase implements SolrCache { @Override public void warm(SolrIndexSearcher searcher, SolrCache old) { if (regenerator==null) return; - long warmingStartTime = System.currentTimeMillis(); + long warmingStartTime = System.nanoTime(); LRUCache other = (LRUCache)old; // warm entries @@ -194,7 +195,7 @@ public class LRUCache extends SolrCacheBase implements SolrCache { } } - warmupTime = System.currentTimeMillis() - warmingStartTime; + warmupTime = TimeUnit.MILLISECONDS.convert(System.nanoTime() - warmingStartTime, TimeUnit.NANOSECONDS); }