提交 ab1591ed 编写于 作者: P poonam

8071487: javax/management/monitor/GaugeMonitorDeadlockTest.java timed out

Reviewed-by: dholmes
上级 eca3b715
......@@ -27,6 +27,7 @@
* @summary Test that no locks are held when a monitor attribute is sampled
* or notif delivered.
* @author Eamonn McManus
* @library /lib/testlibrary
* @run clean GaugeMonitorDeadlockTest
* @run build GaugeMonitorDeadlockTest
* @run main GaugeMonitorDeadlockTest 1
......@@ -47,6 +48,8 @@ import javax.management.ObjectName;
import javax.management.monitor.GaugeMonitor;
import javax.management.monitor.GaugeMonitorMBean;
import jdk.testlibrary.Utils;
public class GaugeMonitorDeadlockTest {
private static enum When {IN_GET_ATTRIBUTE, IN_NOTIFY};
private static long checkingTime;
......@@ -54,8 +57,7 @@ public class GaugeMonitorDeadlockTest {
public static void main(String[] args) throws Exception {
if (args.length != 1)
throw new Exception("Arg should be test number");
double factor = Double.parseDouble(System.getProperty("test.timeout.factor", "1.0"));
checkingTime = (long)factor*1000;
checkingTime = Utils.adjustTimeout(1000); // default 1s timeout
System.out.println("=== checkingTime = " + checkingTime + "ms");
int testNo = Integer.parseInt(args[0]) - 1;
......@@ -101,11 +103,12 @@ public class GaugeMonitorDeadlockTest {
monitorProxy.setGranularityPeriod(10L); // 10 ms
monitorProxy.setNotifyHigh(true);
monitorProxy.setNotifyLow(true);
monitorProxy.start();
System.out.println("=== Waiting observedProxy.getGetCount() to be "
+ "changed, presumable deadlock if timeout?");
final int initGetCount = observedProxy.getGetCount();
monitorProxy.start();
long checkedTime = System.currentTimeMillis();
long nowTime;
ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
......
......@@ -37,7 +37,6 @@
import java.lang.management.ManagementFactory;
import java.util.concurrent.atomic.AtomicInteger;
import javax.management.Attribute;
import javax.management.JMX;
import javax.management.MBeanServer;
import javax.management.Notification;
......@@ -95,9 +94,10 @@ public class StringMonitorDeadlockTest {
monitorProxy.setStringToCompare("old");
monitorProxy.setGranularityPeriod(10L); // 10 ms
monitorProxy.setNotifyDiffer(true);
monitorProxy.start();
final int initGetCount = observedProxy.getGetCount();
monitorProxy.start();
int getCount = initGetCount;
for (int i = 0; i < 500; i++) { // 500 * 10 = 5 seconds
getCount = observedProxy.getGetCount();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册