JDK 9 RFR of JDK-8132548: java/lang/ThreadGroup/Stop.java fails with "RuntimeException: Failure"
Amy Lu
amy.lu at oracle.com
Fri Jul 8 02:01:28 UTC 2016
Please review this trivial fix for test:java/lang/ThreadGroup/Stop.java
Though this is a test for a deprecated API, failed with very very low
frequency and hard to reproduce (I got no luck to reproduce it), I’d
like to patch it as suggested: extend the sleep in the main thread from
one second to five seconds. Also added 'volatile' to the boolean
variable 'groupStopped'.
bug: https://bugs.openjdk.java.net/browse/JDK-8132548
webrev: http://cr.openjdk.java.net/~amlu/8132548/webrev.00/
Thanks,
Amy
--- old/test/java/lang/ThreadGroup/Stop.java 2016-07-04 14:53:59.000000000 +0800
+++ new/test/java/lang/ThreadGroup/Stop.java 2016-07-04 14:53:58.000000000 +0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,7 @@
*/
public class Stop implements Runnable {
- private static boolean groupStopped = false ;
+ private static volatile boolean groupStopped = false ;
private static final Object lock = new Object();
private static final ThreadGroup group = new ThreadGroup("");
@@ -70,7 +70,7 @@
while (!groupStopped) {
lock.wait();
// Give the other thread a chance to stop
- Thread.sleep(1000);
+ Thread.sleep(5000);
}
}
More information about the core-libs-dev
mailing list