< prev index next >

test/java/lang/management/ThreadMXBean/LockedMonitors.java

Print this page
rev 16783 : 8176176: fix @modules in jdk_svc tests
Reviewed-by: duke


  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 /*
  25  * @test
  26  * @bug     5086470 6358247
  27  * @summary Basic Test for ThreadInfo.getLockedMonitors()
  28  *          - a stack frame acquires no monitor
  29  *          - a stack frame acquires one or more monitors
  30  *          - a stack frame blocks on Object.wait
  31  *            and the monitor waiting is not locked.
  32  *          LockingThread is the class that creates threads
  33  *          and do the checking.
  34  *
  35  * @author  Mandy Chung
  36  *
  37  * @modules java.management
  38  * @build Barrier
  39  * @build LockingThread
  40  * @build ThreadDump
  41  * @run main/othervm LockedMonitors
  42  */
  43 
  44 import java.lang.management.*;
  45 import java.util.*;
  46 
  47 public class LockedMonitors {
  48     public static void main(String[] argv) throws Exception {
  49         ThreadMXBean mbean = ManagementFactory.getThreadMXBean();
  50         if (!mbean.isObjectMonitorUsageSupported()) {
  51             System.out.println("Monitoring of object monitor usage is not supported");
  52             return;
  53         }
  54 
  55         // Start the thread and print the thread dump
  56         LockingThread.startLockingThreads();
  57         ThreadDump.threadDump();




  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 /*
  25  * @test
  26  * @bug     5086470 6358247
  27  * @summary Basic Test for ThreadInfo.getLockedMonitors()
  28  *          - a stack frame acquires no monitor
  29  *          - a stack frame acquires one or more monitors
  30  *          - a stack frame blocks on Object.wait
  31  *            and the monitor waiting is not locked.
  32  *          LockingThread is the class that creates threads
  33  *          and do the checking.
  34  *
  35  * @author  Mandy Chung
  36  *

  37  * @build Barrier
  38  * @build LockingThread
  39  * @build ThreadDump
  40  * @run main/othervm LockedMonitors
  41  */
  42 
  43 import java.lang.management.*;
  44 import java.util.*;
  45 
  46 public class LockedMonitors {
  47     public static void main(String[] argv) throws Exception {
  48         ThreadMXBean mbean = ManagementFactory.getThreadMXBean();
  49         if (!mbean.isObjectMonitorUsageSupported()) {
  50             System.out.println("Monitoring of object monitor usage is not supported");
  51             return;
  52         }
  53 
  54         // Start the thread and print the thread dump
  55         LockingThread.startLockingThreads();
  56         ThreadDump.threadDump();


< prev index next >