< prev index next > test/hotspot/jtreg/runtime/whitebox/TestWBDeflateIdleMonitors.java
Print this page
public static class InflateMonitorsTest {
static WhiteBox wb = WhiteBox.getWhiteBox();
public static Object obj;
! public static void main(String args[]) {
obj = new Object();
synchronized (obj) {
! // HotSpot implementation detail: asking for the hash code
! // when the object is locked causes monitor inflation.
- if (obj.hashCode() == 0xBAD) System.out.println("!");
Asserts.assertEQ(wb.isMonitorInflated(obj), true,
"Monitor should be inflated.");
}
for (int cnt = 1; cnt <= N_TRIES; cnt++) {
System.out.println("Deflation try #" + cnt);
public static class InflateMonitorsTest {
static WhiteBox wb = WhiteBox.getWhiteBox();
public static Object obj;
! public static void main(String args[]) throws Exception {
obj = new Object();
synchronized (obj) {
! // The current implementation of notify-wait requires inflation.
! obj.wait(1);
Asserts.assertEQ(wb.isMonitorInflated(obj), true,
"Monitor should be inflated.");
}
for (int cnt = 1; cnt <= N_TRIES; cnt++) {
System.out.println("Deflation try #" + cnt);
< prev index next >