lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From no...@apache.org
Subject svn commit: r1628747 - /lucene/dev/trunk/solr/core/src/java/org/apache/solr/schema/SchemaManager.java
Date Wed, 01 Oct 2014 15:58:15 GMT
Author: noble
Date: Wed Oct  1 15:58:15 2014
New Revision: 1628747

URL: http://svn.apache.org/r1628747
Log:
SOLR-6476

Modified:
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/schema/SchemaManager.java

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/schema/SchemaManager.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/schema/SchemaManager.java?rev=1628747&r1=1628746&r2=1628747&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/schema/SchemaManager.java (original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/schema/SchemaManager.java Wed Oct
 1 15:58:15 2014
@@ -39,6 +39,7 @@ import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.concurrent.TimeUnit;
 
 import static java.util.Collections.EMPTY_LIST;
 import static java.util.Collections.EMPTY_MAP;
@@ -156,15 +157,13 @@ public class SchemaManager {
       String collection = cd.getCollectionName();
       if (collection != null) {
         ZkSolrResourceLoader zkLoader = (ZkSolrResourceLoader) managedIndexSchema.getResourceLoader();
-        long timeLeftSecs1 = timeout -  ((System.nanoTime() - startTime) /1000000);
-        int secsLeft = (int) (timeLeftSecs1 > 0 ? timeLeftSecs1 : -1);
-        if(secsLeft<=0) throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
"Not enough time left to update replicas. However the schema is updated already");
-        long timeLeftSecs = timeout -  ((System.nanoTime() - startTime) /1000000);
+        long timeLeftSecs = timeout -   TimeUnit.SECONDS.convert(System.nanoTime() - startTime,
TimeUnit.NANOSECONDS);
+        if(timeLeftSecs<=0) throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
"Not enough time left to update replicas. However the schema is updated already");
         ManagedIndexSchema.waitForSchemaZkVersionAgreement(collection,
             cd.getCloudDescriptor().getCoreNodeName(),
             (managedIndexSchema).getSchemaZkVersion(),
             zkLoader.getZkController(),
-            (int) (timeLeftSecs > 0 ? timeLeftSecs : -1));
+            (int) timeLeftSecs);
       }
 
     }



Mime
View raw message