# HG changeset patch # User sjiang # Date 1399034452 -7200 # Node ID 0e2a906a043d5202f34049b1d64777c71919f619 # Parent 0d1f816217dce5e72187f167cc1816080cbeb453 8031036: com/sun/management/OperatingSystemMXBean/GetCommittedVirtualMemorySize.java failed on 8b121 Reviewed-by: dfuchs diff -r 0d1f816217dc -r 0e2a906a043d jdk/test/javax/management/monitor/CounterMonitorDeadlockTest.java --- a/jdk/test/javax/management/monitor/CounterMonitorDeadlockTest.java Wed Jul 05 19:39:35 2017 +0200 +++ b/jdk/test/javax/management/monitor/CounterMonitorDeadlockTest.java Fri May 02 14:40:52 2014 +0200 @@ -98,13 +98,13 @@ monitorProxy.start(); final int initGetCount = observedProxy.getGetCount(); - int getCount = initGetCount; - for (int i = 0; i < 500; i++) { // 500 * 10 = 5 seconds - getCount = observedProxy.getGetCount(); - if (getCount != initGetCount) - break; - Thread.sleep(10); - } + 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); + 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 @@ -131,10 +131,11 @@ }; mbs.addNotificationListener(monitorName, listener, null, null); observedProxy.setThing(1000); - for (int i = 0; i < 500 && notifCount.get() == 0; i++) - Thread.sleep(10); - if (notifCount.get() == 0) - throw new Exception("Test failed: presumable deadlock"); + System.out.println("Waiting notifCount.get() != 0, possible deadlock if timeout."); + do { + Thread.sleep(200); + } while(notifCount.get() == 0); // 8038322. Until timeout of testing harness + System.out.println("Done"); } }