8038982: java/lang/ref/EarlyTimeout.java failed again

Reviewed-by: mchung
This commit is contained in:
Ivan Gerasimov 2014-04-18 18:46:50 +04:00
parent cb5eb6cd31
commit 0688bf058d

View File

@ -33,6 +33,7 @@ import java.lang.ref.Reference;
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 class EarlyTimeout extends Thread {
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);
}