From b310514becf93ff3a9eaf5bd7af632b591b22a80 Mon Sep 17 00:00:00 2001 From: Tomas Fernandez Lobbe Date: Tue, 30 Jan 2018 14:28:27 -0800 Subject: [PATCH] SOLR-11782: Use await(millis, TimeUnit.MILLIS) in LatchWatcher.await --- .../java/org/apache/solr/cloud/OverseerTaskQueue.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) 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 368736960c1..276725861e9 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(); }