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

This commit is contained in:
Tomas Fernandez Lobbe 2018-01-30 14:28:27 -08:00
parent 4176231e91
commit b310514bec
1 changed files with 3 additions and 6 deletions

View File

@ -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();
}