OpenJDK / jdk / jdk10
changeset 24028:4a61f1fe9c7c
8038982: java/lang/ref/EarlyTimeout.java failed again
Reviewed-by: mchung
author | igerasim |
---|---|
date | Fri, 18 Apr 2014 18:46:50 +0400 |
parents | 63144ee0e772 |
children | 999562dbc988 |
files | jdk/test/java/lang/ref/EarlyTimeout.java |
diffstat | 1 files changed, 3 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/jdk/test/java/lang/ref/EarlyTimeout.java Thu Apr 17 18:20:31 2014 +0200 +++ b/jdk/test/java/lang/ref/EarlyTimeout.java Fri Apr 18 18:46:50 2014 +0400 @@ -33,6 +33,7 @@ import java.lang.ref.ReferenceQueue; import java.lang.ref.WeakReference; import java.util.concurrent.CountDownLatch; +import static java.util.concurrent.TimeUnit.NANOSECONDS; /** * In order to demonstrate the issue we make several threads (two appears to be sufficient) @@ -93,9 +94,9 @@ public void run() { try { startedSignal.countDown(); - long start = System.currentTimeMillis(); + long start = System.nanoTime(); reference = queue.remove(TIMEOUT); - actual = System.currentTimeMillis() - start; + actual = NANOSECONDS.toMillis(System.nanoTime() - start); } catch (InterruptedException ex) { throw new RuntimeException(ex); }