Skip to content

Commit 8b37c2c

Browse files
author
Daniel D. Daugherty
committed
8257468: runtime/whitebox/TestWBDeflateIdleMonitors.java fails with Monitor should be deflated.: expected true to equal false
Reviewed-by: hseigel
1 parent 9cd8e38 commit 8b37c2c

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

test/hotspot/jtreg/runtime/whitebox/TestWBDeflateIdleMonitors.java

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@
4040
import sun.hotspot.WhiteBox;
4141

4242
public class TestWBDeflateIdleMonitors {
43+
static final int N_DELAY = 1000; // delay between tries
44+
static final int N_TRIES = 5; // number of times to try deflation
4345

4446
public static void main(String args[]) throws Exception {
4547
ProcessBuilder pb = ProcessTools.createTestJvm(
@@ -68,9 +70,22 @@ public static void main(String args[]) {
6870
Asserts.assertEQ(wb.isMonitorInflated(obj), true,
6971
"Monitor should be inflated.");
7072
}
71-
boolean did_deflation = wb.deflateIdleMonitors();
72-
Asserts.assertEQ(did_deflation, true,
73-
"deflateIdleMonitors() should have worked.");
73+
for (int cnt = 1; cnt <= N_TRIES; cnt++) {
74+
System.out.println("Deflation try #" + cnt);
75+
boolean did_deflation = wb.deflateIdleMonitors();
76+
Asserts.assertEQ(did_deflation, true,
77+
"deflateIdleMonitors() should have worked.");
78+
if (!wb.isMonitorInflated(obj)) {
79+
// Deflation worked so no more retries needed.
80+
break;
81+
}
82+
try {
83+
System.out.println("Deflation try #" + cnt + " failed. "
84+
+ "Delaying before retry.");
85+
Thread.sleep(N_DELAY);
86+
} catch (InterruptedException ie) {
87+
}
88+
}
7489
Asserts.assertEQ(wb.isMonitorInflated(obj), false,
7590
"Monitor should be deflated.");
7691
}

0 commit comments

Comments
 (0)