diff --git a/engine/api/src/main/java/io/deephaven/engine/table/Table.java b/engine/api/src/main/java/io/deephaven/engine/table/Table.java index c784a10fedb..1fc9c6aa620 100644 --- a/engine/api/src/main/java/io/deephaven/engine/table/Table.java +++ b/engine/api/src/main/java/io/deephaven/engine/table/Table.java @@ -820,12 +820,12 @@ RollupTable rollup(Collection aggregations, boolean inclu *

* In some implementations, this call may also terminate in case of interrupt or spurious wakeup. * - * @param timeout The maximum time to wait in milliseconds. + * @param timeoutMillis The maximum time to wait in milliseconds. * @return false if the timeout elapses without notification, true otherwise. * @throws InterruptedException In the event this thread is interrupted * @see java.util.concurrent.locks.Condition#await() */ - boolean awaitUpdate(long timeout) throws InterruptedException; + boolean awaitUpdate(long timeoutMillis) throws InterruptedException; /** * Subscribe for updates to this table. {@code listener} will be invoked via the {@link NotificationQueue} diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/BaseTable.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/BaseTable.java index 9c90706ddb0..11128be3e44 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/BaseTable.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/BaseTable.java @@ -525,26 +525,23 @@ public void awaitUpdate() throws InterruptedException { } @Override - public boolean awaitUpdate(long timeout) throws InterruptedException { + public boolean awaitUpdate(long timeoutMillis) throws InterruptedException { final long startTime = System.nanoTime(); - if (!updateGraph.exclusiveLock().tryLock(timeout, TimeUnit.MILLISECONDS)) { + if (!updateGraph.exclusiveLock().tryLock(timeoutMillis, TimeUnit.MILLISECONDS)) { // Usually, users will already be holding the exclusive lock when calling this method. If they are not and // cannot acquire the lock within the timeout, we should return false now. return false; } - timeout -= (System.nanoTime() - startTime) / 1_000_000; + timeoutMillis -= TimeUnit.MILLISECONDS.convert(System.nanoTime() - startTime, TimeUnit.NANOSECONDS); - boolean result; try { // Note that we must reacquire the exclusive lock before returning from await. This deadline may be // exceeded if the thread must wait to reacquire the lock. - result = ensureCondition().await(timeout, TimeUnit.MILLISECONDS); + return ensureCondition().await(timeoutMillis, TimeUnit.MILLISECONDS); } finally { updateGraph.exclusiveLock().unlock(); } - - return result; } private Condition ensureCondition() { diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/TableAdapter.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/TableAdapter.java index 171defa9953..54356a377fc 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/TableAdapter.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/TableAdapter.java @@ -357,7 +357,7 @@ default void awaitUpdate() throws InterruptedException { @SuppressWarnings("RedundantThrows") @Override - default boolean awaitUpdate(long timeout) throws InterruptedException { + default boolean awaitUpdate(long timeoutMillis) throws InterruptedException { return throwUnsupported(); } diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/UncoalescedTable.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/UncoalescedTable.java index bbcd8ad0dd4..00bfcfb808f 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/UncoalescedTable.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/UncoalescedTable.java @@ -459,8 +459,8 @@ public void awaitUpdate() throws InterruptedException { } @Override - public boolean awaitUpdate(long timeout) throws InterruptedException { - return coalesce().awaitUpdate(timeout); + public boolean awaitUpdate(long timeoutMillis) throws InterruptedException { + return coalesce().awaitUpdate(timeoutMillis); } @Override