8068774: CounterMonitorDeadlockTest.java timed out
Reviewed-by: jbachorik, dfuchs
--- a/jdk/test/javax/management/monitor/CounterMonitorDeadlockTest.java Tue Jan 13 14:26:34 2015 +0300
+++ b/jdk/test/javax/management/monitor/CounterMonitorDeadlockTest.java Tue Jan 13 14:35:39 2015 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, 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
@@ -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,18 +94,16 @@
monitorProxy.setInitThreshold(100);
monitorProxy.setGranularityPeriod(10L); // 10 ms
monitorProxy.setNotify(true);
+
+ final int initGetCount = observedProxy.getGetCount();
monitorProxy.start();
- final int initGetCount = observedProxy.getGetCount();
- int getCount;
System.out.println("Checking GetCount, possible deadlock if timeout.");
do { // 8038322. Until timeout of testing harness
Thread.sleep(200);
- } while ((getCount=observedProxy.getGetCount()) == initGetCount);
+ } while ((observedProxy.getGetCount()) == initGetCount);
System.out.println("Done!");
- if (getCount <= initGetCount)
- throw new Exception("Test failed: presumable deadlock");
// This won't show up as a deadlock in CTRL-\ or in
// ThreadMXBean.findDeadlockedThreads(), because they don't
// see that thread A is waiting for thread B (B.join()), and