8038982: java/lang/ref/EarlyTimeout.java failed again
Reviewed-by: mchung
This commit is contained in:
parent
cb5eb6cd31
commit
0688bf058d
@ -33,6 +33,7 @@ import java.lang.ref.Reference;
|
|||||||
import java.lang.ref.ReferenceQueue;
|
import java.lang.ref.ReferenceQueue;
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.util.concurrent.CountDownLatch;
|
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)
|
* 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() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
startedSignal.countDown();
|
startedSignal.countDown();
|
||||||
long start = System.currentTimeMillis();
|
long start = System.nanoTime();
|
||||||
reference = queue.remove(TIMEOUT);
|
reference = queue.remove(TIMEOUT);
|
||||||
actual = System.currentTimeMillis() - start;
|
actual = NANOSECONDS.toMillis(System.nanoTime() - start);
|
||||||
} catch (InterruptedException ex) {
|
} catch (InterruptedException ex) {
|
||||||
throw new RuntimeException(ex);
|
throw new RuntimeException(ex);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user