< prev index next >

test/hotspot/jtreg/serviceability/jvmti/events/MonitorWaited/monitorwaited01/monitorwaited01.java

Print this page

  1 /*
  2  * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved.
  3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  4  *
  5  * This code is free software; you can redistribute it and/or modify it
  6  * under the terms of the GNU General Public License version 2 only, as
  7  * published by the Free Software Foundation.
  8  *
  9  * This code is distributed in the hope that it will be useful, but WITHOUT
 10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 12  * version 2 for more details (a copy is included in the LICENSE file that
 13  * accompanied this code).
 14  *
 15  * You should have received a copy of the GNU General Public License version
 16  * 2 along with this work; if not, write to the Free Software Foundation,
 17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  */
 23 
 24 import jdk.test.lib.jvmti.DebugeeClass;
 25 
 26 /*
 27  * @test
 28  *
 29  * @summary converted from VM Testbase nsk/jvmti/MonitorWaited/monitorwaited001.
 30  * VM Testbase keywords: [quick, jpda, jvmti, noras]
 31  * VM Testbase readme:
 32  * DESCRIPTION
 33  *     The test exercises JVMTI event callback function
 34  *         MonitorWaited(jni, thread, object, timed_out).
 35  *     The test checks if the thread, object, and timed_out parameters of
 36  *     the function contain expected values for callback when a thread finishes
 37  *     waiting on an object.
 38  * COMMENTS
 39  *     The test updated to match new JVMTI spec 0.2.90:
 40  *     - change signature of agentProc function
 41  *       and save JNIEnv pointer now passed as argument.
 42  *

 43  * @library /test/lib
 44  * @compile monitorwaited01.java
 45  * @run main/othervm/native -agentlib:monitorwaited01 monitorwaited01 platform
 46  * @run main/othervm/native -agentlib:monitorwaited01 monitorwaited01 virtual
 47  */
 48 
 49 
 50 
 51 public class monitorwaited01 extends DebugeeClass {
 52 
 53     static {
 54         loadLibrary("monitorwaited01");
 55     }
 56 
 57     public static void main(String args[]) {
 58         boolean isVirtual = "virtual".equals(args[0]);
 59         int result = new monitorwaited01().runIt(isVirtual);
 60         if (result != 0) {
 61             throw new RuntimeException("Unexpected status: " + result);
 62         }

  1 /*
  2  * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
  3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  4  *
  5  * This code is free software; you can redistribute it and/or modify it
  6  * under the terms of the GNU General Public License version 2 only, as
  7  * published by the Free Software Foundation.
  8  *
  9  * This code is distributed in the hope that it will be useful, but WITHOUT
 10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 12  * version 2 for more details (a copy is included in the LICENSE file that
 13  * accompanied this code).
 14  *
 15  * You should have received a copy of the GNU General Public License version
 16  * 2 along with this work; if not, write to the Free Software Foundation,
 17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 18  *
 19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 20  * or visit www.oracle.com if you need additional information or have any
 21  * questions.
 22  */
 23 
 24 import jdk.test.lib.jvmti.DebugeeClass;
 25 
 26 /*
 27  * @test
 28  *
 29  * @summary converted from VM Testbase nsk/jvmti/MonitorWaited/monitorwaited001.
 30  * VM Testbase keywords: [quick, jpda, jvmti, noras]
 31  * VM Testbase readme:
 32  * DESCRIPTION
 33  *     The test exercises JVMTI event callback function
 34  *         MonitorWaited(jni, thread, object, timed_out).
 35  *     The test checks if the thread, object, and timed_out parameters of
 36  *     the function contain expected values for callback when a thread finishes
 37  *     waiting on an object.
 38  * COMMENTS
 39  *     The test updated to match new JVMTI spec 0.2.90:
 40  *     - change signature of agentProc function
 41  *       and save JNIEnv pointer now passed as argument.
 42  *
 43  * @requires vm.continuations
 44  * @library /test/lib
 45  * @compile monitorwaited01.java
 46  * @run main/othervm/native -agentlib:monitorwaited01 monitorwaited01 platform
 47  * @run main/othervm/native -agentlib:monitorwaited01 monitorwaited01 virtual
 48  */
 49 
 50 
 51 
 52 public class monitorwaited01 extends DebugeeClass {
 53 
 54     static {
 55         loadLibrary("monitorwaited01");
 56     }
 57 
 58     public static void main(String args[]) {
 59         boolean isVirtual = "virtual".equals(args[0]);
 60         int result = new monitorwaited01().runIt(isVirtual);
 61         if (result != 0) {
 62             throw new RuntimeException("Unexpected status: " + result);
 63         }
< prev index next >