< prev index next >

test/java/lang/instrument/RedefineMethodInBacktraceApp.java

Print this page
rev 11832 : 8078896: Add @modules as needed to the jdk_svc tests
Reviewed-by: alanb, mchung

*** 1,7 **** /* ! * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 29,39 **** import java.lang.management.ManagementFactory; import java.lang.management.ThreadInfo; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.concurrent.CountDownLatch; ! import sun.management.ManagementFactoryHelper; /** * When an exception is thrown, the JVM collects just enough information * about the stack trace to be able to create a full fledged stack trace * (StackTraceElement[]). The backtrace contains this information and the --- 29,40 ---- import java.lang.management.ManagementFactory; import java.lang.management.ThreadInfo; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.concurrent.CountDownLatch; ! import javax.management.MBeanServer; ! import javax.management.ObjectName; /** * When an exception is thrown, the JVM collects just enough information * about the stack trace to be able to create a full fledged stack trace * (StackTraceElement[]). The backtrace contains this information and the
*** 90,104 **** ThreadInfo[] tis = ManagementFactory.getThreadMXBean().dumpAllThreads(false, false); for(ThreadInfo ti : tis) { System.out.println(ti); } String[] threadPrintArgs = {}; Object[] dcmdArgs = {threadPrintArgs}; String[] signature = {String[].class.getName()}; ! DiagnosticCommandMBean dcmd = ManagementFactoryHelper.getDiagnosticCommandMBean(); ! System.out.println(dcmd.invoke("threadPrint", dcmdArgs, signature)); // release the thread stop.countDown(); } --- 91,107 ---- ThreadInfo[] tis = ManagementFactory.getThreadMXBean().dumpAllThreads(false, false); for(ThreadInfo ti : tis) { System.out.println(ti); } + MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); + ObjectName name = new ObjectName("com.sun.management:type=DiagnosticCommand"); String[] threadPrintArgs = {}; Object[] dcmdArgs = {threadPrintArgs}; String[] signature = {String[].class.getName()}; ! Object result = mbs.invoke(name, "threadPrint", dcmdArgs, signature); ! System.out.println(result); // release the thread stop.countDown(); }
< prev index next >