You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by tf...@apache.org on 2018/01/30 22:32:52 UTC

lucene-solr:master: SOLR-11782: Use await(millis, TimeUnit.MILLIS) in LatchWatcher.await

Repository: lucene-solr
Updated Branches:
  refs/heads/master 4176231e9 -> b310514be


SOLR-11782: Use await(millis, TimeUnit.MILLIS) in LatchWatcher.await


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/b310514b
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/b310514b
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/b310514b

Branch: refs/heads/master
Commit: b310514becf93ff3a9eaf5bd7af632b591b22a80
Parents: 4176231
Author: Tomas Fernandez Lobbe <tf...@apache.org>
Authored: Tue Jan 30 14:28:27 2018 -0800
Committer: Tomas Fernandez Lobbe <tf...@apache.org>
Committed: Tue Jan 30 14:28:27 2018 -0800

----------------------------------------------------------------------
 .../src/java/org/apache/solr/cloud/OverseerTaskQueue.java   | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/b310514b/solr/core/src/java/org/apache/solr/cloud/OverseerTaskQueue.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/OverseerTaskQueue.java b/solr/core/src/java/org/apache/solr/cloud/OverseerTaskQueue.java
index 3687369..2767258 100644
--- a/solr/core/src/java/org/apache/solr/cloud/OverseerTaskQueue.java
+++ b/solr/core/src/java/org/apache/solr/cloud/OverseerTaskQueue.java
@@ -150,15 +150,12 @@ public class OverseerTaskQueue extends ZkDistributedQueue {
 
     public void await(long timeoutMs) throws InterruptedException {
       assert timeoutMs > 0;
-      long timeoutNanos = TimeUnit.MILLISECONDS.toNanos(timeoutMs);
       lock.lock();
       try {
-        while (this.event == null) {
-          if (timeoutNanos <= 0) {
-            return;
-          }
-          timeoutNanos = eventReceived.awaitNanos(timeoutNanos);
+        if (this.event != null) {
+          return;
         }
+        eventReceived.await(timeoutMs, TimeUnit.MILLISECONDS);
       } finally {
         lock.unlock();
       }