Skip to content

Commit 9ef9733

Browse files
committed
BlockingCell now consistently uses System.nanoTime rather than sometimes using System.currentTimeMillis
1 parent 25576af commit 9ef9733

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/main/java/com/rabbitmq/utility/BlockingCell.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@ public synchronized T get(long timeout) throws InterruptedException, TimeoutExce
6666
if (timeout < 0)
6767
throw new AssertionError("Timeout cannot be less than zero");
6868

69-
long maxTime = System.currentTimeMillis() + timeout;
70-
long now;
71-
while (!_filled && (now = System.currentTimeMillis()) < maxTime) {
69+
long now = System.nanoTime() / NANOS_IN_MILLI;
70+
long maxTime = now + timeout;
71+
while (!_filled && (now = (System.nanoTime() / NANOS_IN_MILLI)) < maxTime) {
7272
wait(maxTime - now);
7373
}
7474

0 commit comments

Comments
 (0)