com.sun.management.DiagnosticCommandMBean Java Examples
The following examples show how to use
com.sun.management.DiagnosticCommandMBean.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: NMTHelper.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
private static String executeDcmd(String cmd, String ... args) { DiagnosticCommandMBean dcmd = ManagementFactoryHelper.getDiagnosticCommandMBean(); Object[] dcmdArgs = {args}; String[] signature = {String[].class.getName()}; String cmdString = cmd + " " + Arrays.stream(args).collect(Collectors.joining(" ")); File f = new File("dcmdoutput-" + cmd + "-" + System.currentTimeMillis() + ".txt"); System.out.println("Output from Dcmd '" + cmdString + "' is being written to file " + f); try (FileWriter fw = new FileWriter(f)) { fw.write("> " + cmdString + ":"); String result = (String) dcmd.invoke(cmd, dcmdArgs, signature); fw.write(result); return result; } catch(Exception ex) { ex.printStackTrace(); } return null; }
Example #2
Source File: NMTHelper.java From hottub with GNU General Public License v2.0 | 6 votes |
private static String executeDcmd(String cmd, String ... args) { DiagnosticCommandMBean dcmd = ManagementFactoryHelper.getDiagnosticCommandMBean(); Object[] dcmdArgs = {args}; String[] signature = {String[].class.getName()}; String cmdString = cmd + " " + Arrays.stream(args).collect(Collectors.joining(" ")); File f = new File("dcmdoutput-" + cmd + "-" + System.currentTimeMillis() + ".txt"); System.out.println("Output from Dcmd '" + cmdString + "' is being written to file " + f); try (FileWriter fw = new FileWriter(f)) { fw.write("> " + cmdString + ":"); String result = (String) dcmd.invoke(cmd, dcmdArgs, signature); fw.write(result); return result; } catch(Exception ex) { ex.printStackTrace(); } return null; }
Example #3
Source File: NMTHelper.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
private static String executeDcmd(String cmd, String ... args) { DiagnosticCommandMBean dcmd = ManagementFactoryHelper.getDiagnosticCommandMBean(); Object[] dcmdArgs = {args}; String[] signature = {String[].class.getName()}; try { System.out.print("> " + cmd + " "); for (String s : args) { System.out.print(s + " "); } System.out.println(":"); String result = (String) dcmd.invoke(cmd, dcmdArgs, signature); System.out.println(result); return result; } catch(Exception ex) { ex.printStackTrace(); } return null; }
Example #4
Source File: NMTHelper.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
private static String executeDcmd(String cmd, String ... args) { DiagnosticCommandMBean dcmd = ManagementFactoryHelper.getDiagnosticCommandMBean(); Object[] dcmdArgs = {args}; String[] signature = {String[].class.getName()}; String cmdString = cmd + " " + Arrays.stream(args).collect(Collectors.joining(" ")); File f = new File("dcmdoutput-" + cmd + "-" + System.currentTimeMillis() + ".txt"); System.out.println("Output from Dcmd '" + cmdString + "' is being written to file " + f); try (FileWriter fw = new FileWriter(f)) { fw.write("> " + cmdString + ":"); String result = (String) dcmd.invoke(cmd, dcmdArgs, signature); fw.write(result); return result; } catch(Exception ex) { ex.printStackTrace(); } return null; }
Example #5
Source File: NMTHelper.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
private static String executeDcmd(String cmd, String ... args) { DiagnosticCommandMBean dcmd = ManagementFactoryHelper.getDiagnosticCommandMBean(); Object[] dcmdArgs = {args}; String[] signature = {String[].class.getName()}; try { System.out.print("> " + cmd + " "); for (String s : args) { System.out.print(s + " "); } System.out.println(":"); String result = (String) dcmd.invoke(cmd, dcmdArgs, signature); System.out.println(result); return result; } catch(Exception ex) { ex.printStackTrace(); } return null; }
Example #6
Source File: NMTHelper.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
private static String executeDcmd(String cmd, String ... args) { DiagnosticCommandMBean dcmd = ManagementFactoryHelper.getDiagnosticCommandMBean(); Object[] dcmdArgs = {args}; String[] signature = {String[].class.getName()}; String cmdString = cmd + " " + Arrays.stream(args).collect(Collectors.joining(" ")); File f = new File("dcmdoutput-" + cmd + "-" + System.currentTimeMillis() + ".txt"); System.out.println("Output from Dcmd '" + cmdString + "' is being written to file " + f); try (FileWriter fw = new FileWriter(f)) { fw.write("> " + cmdString + ":"); String result = (String) dcmd.invoke(cmd, dcmdArgs, signature); fw.write(result); return result; } catch(Exception ex) { ex.printStackTrace(); } return null; }
Example #7
Source File: DcmdUtil.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
public static String executeDcmd(String cmd, String ... args) { DiagnosticCommandMBean dcmd = ManagementFactoryHelper.getDiagnosticCommandMBean(); Object[] dcmdArgs = {args}; String[] signature = {String[].class.getName()}; try { System.out.print("> " + cmd + " "); for (String s : args) { System.out.print(s + " "); } System.out.println(":"); String result = (String) dcmd.invoke(transform(cmd), dcmdArgs, signature); System.out.println(result); return result; } catch(Exception ex) { ex.printStackTrace(); } return null; }
Example #8
Source File: NMTHelper.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
private static String executeDcmd(String cmd, String ... args) { DiagnosticCommandMBean dcmd = ManagementFactoryHelper.getDiagnosticCommandMBean(); Object[] dcmdArgs = {args}; String[] signature = {String[].class.getName()}; String cmdString = cmd + " " + Arrays.stream(args).collect(Collectors.joining(" ")); File f = new File("dcmdoutput-" + cmd + "-" + System.currentTimeMillis() + ".txt"); System.out.println("Output from Dcmd '" + cmdString + "' is being written to file " + f); try (FileWriter fw = new FileWriter(f)) { fw.write("> " + cmdString + ":"); String result = (String) dcmd.invoke(cmd, dcmdArgs, signature); fw.write(result); return result; } catch(Exception ex) { ex.printStackTrace(); } return null; }
Example #9
Source File: DcmdUtil.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
public static String executeDcmd(String cmd, String ... args) { DiagnosticCommandMBean dcmd = ManagementFactoryHelper.getDiagnosticCommandMBean(); Object[] dcmdArgs = {args}; String[] signature = {String[].class.getName()}; try { System.out.print("> " + cmd + " "); for (String s : args) { System.out.print(s + " "); } System.out.println(":"); String result = (String) dcmd.invoke(transform(cmd), dcmdArgs, signature); System.out.println(result); return result; } catch(Exception ex) { ex.printStackTrace(); } return null; }
Example #10
Source File: NMTHelper.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
private static String executeDcmd(String cmd, String ... args) { DiagnosticCommandMBean dcmd = ManagementFactoryHelper.getDiagnosticCommandMBean(); Object[] dcmdArgs = {args}; String[] signature = {String[].class.getName()}; String cmdString = cmd + " " + Arrays.stream(args).collect(Collectors.joining(" ")); File f = new File("dcmdoutput-" + cmd + "-" + System.currentTimeMillis() + ".txt"); System.out.println("Output from Dcmd '" + cmdString + "' is being written to file " + f); try (FileWriter fw = new FileWriter(f)) { fw.write("> " + cmdString + ":"); String result = (String) dcmd.invoke(cmd, dcmdArgs, signature); fw.write(result); return result; } catch(Exception ex) { ex.printStackTrace(); } return null; }
Example #11
Source File: NMTHelper.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
private static String executeDcmd(String cmd, String ... args) { DiagnosticCommandMBean dcmd = ManagementFactoryHelper.getDiagnosticCommandMBean(); Object[] dcmdArgs = {args}; String[] signature = {String[].class.getName()}; String cmdString = cmd + " " + Arrays.stream(args).collect(Collectors.joining(" ")); File f = new File("dcmdoutput-" + cmd + "-" + System.currentTimeMillis() + ".txt"); System.out.println("Output from Dcmd '" + cmdString + "' is being written to file " + f); try (FileWriter fw = new FileWriter(f)) { fw.write("> " + cmdString + ":"); String result = (String) dcmd.invoke(cmd, dcmdArgs, signature); fw.write(result); return result; } catch(Exception ex) { ex.printStackTrace(); } return null; }
Example #12
Source File: NMTHelper.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
private static String executeDcmd(String cmd, String ... args) { DiagnosticCommandMBean dcmd = ManagementFactoryHelper.getDiagnosticCommandMBean(); Object[] dcmdArgs = {args}; String[] signature = {String[].class.getName()}; String cmdString = cmd + " " + Arrays.stream(args).collect(Collectors.joining(" ")); File f = new File("dcmdoutput-" + cmd + "-" + System.currentTimeMillis() + ".txt"); System.out.println("Output from Dcmd '" + cmdString + "' is being written to file " + f); try (FileWriter fw = new FileWriter(f)) { fw.write("> " + cmdString + ":"); String result = (String) dcmd.invoke(cmd, dcmdArgs, signature); fw.write(result); return result; } catch(Exception ex) { ex.printStackTrace(); } return null; }
Example #13
Source File: NMTHelper.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
private static String executeDcmd(String cmd, String ... args) { DiagnosticCommandMBean dcmd = ManagementFactoryHelper.getDiagnosticCommandMBean(); Object[] dcmdArgs = {args}; String[] signature = {String[].class.getName()}; String cmdString = cmd + " " + Arrays.stream(args).collect(Collectors.joining(" ")); File f = new File("dcmdoutput-" + cmd + "-" + System.currentTimeMillis() + ".txt"); System.out.println("Output from Dcmd '" + cmdString + "' is being written to file " + f); try (FileWriter fw = new FileWriter(f)) { fw.write("> " + cmdString + ":"); String result = (String) dcmd.invoke(cmd, dcmdArgs, signature); fw.write(result); return result; } catch(Exception ex) { ex.printStackTrace(); } return null; }
Example #14
Source File: NMTHelper.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
private static String executeDcmd(String cmd, String ... args) { DiagnosticCommandMBean dcmd = ManagementFactoryHelper.getDiagnosticCommandMBean(); Object[] dcmdArgs = {args}; String[] signature = {String[].class.getName()}; String cmdString = cmd + " " + Arrays.stream(args).collect(Collectors.joining(" ")); File f = new File("dcmdoutput-" + cmd + "-" + System.currentTimeMillis() + ".txt"); System.out.println("Output from Dcmd '" + cmdString + "' is being written to file " + f); try (FileWriter fw = new FileWriter(f)) { fw.write("> " + cmdString + ":"); String result = (String) dcmd.invoke(cmd, dcmdArgs, signature); fw.write(result); return result; } catch(Exception ex) { ex.printStackTrace(); } return null; }
Example #15
Source File: DcmdUtil.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public static String executeDcmd(String cmd, String ... args) { DiagnosticCommandMBean dcmd = ManagementFactoryHelper.getDiagnosticCommandMBean(); Object[] dcmdArgs = {args}; String[] signature = {String[].class.getName()}; try { System.out.print("> " + cmd + " "); for (String s : args) { System.out.print(s + " "); } System.out.println(":"); String result = (String) dcmd.invoke(transform(cmd), dcmdArgs, signature); System.out.println(result); return result; } catch(Exception ex) { ex.printStackTrace(); } return null; }
Example #16
Source File: ManagementFactoryHelper.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
public static synchronized DiagnosticCommandMBean getDiagnosticCommandMBean() { // Remote Diagnostic Commands may not be supported if (hsDiagCommandMBean == null && jvm.isRemoteDiagnosticCommandsSupported()) { hsDiagCommandMBean = new DiagnosticCommandImpl(jvm); } return hsDiagCommandMBean; }
Example #17
Source File: ManagementFactoryHelper.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public static HashMap<ObjectName, DynamicMBean> getPlatformDynamicMBeans() { HashMap<ObjectName, DynamicMBean> map = new HashMap<>(); DiagnosticCommandMBean diagMBean = getDiagnosticCommandMBean(); if (diagMBean != null) { map.put(Util.newObjectName(HOTSPOT_DIAGNOSTIC_COMMAND_MBEAN_NAME), diagMBean); } return map; }
Example #18
Source File: ManagementFactoryHelper.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public static synchronized DiagnosticCommandMBean getDiagnosticCommandMBean() { // Remote Diagnostic Commands may not be supported if (hsDiagCommandMBean == null && jvm.isRemoteDiagnosticCommandsSupported()) { hsDiagCommandMBean = new DiagnosticCommandImpl(jvm); } return hsDiagCommandMBean; }
Example #19
Source File: ManagementFactoryHelper.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public static HashMap<ObjectName, DynamicMBean> getPlatformDynamicMBeans() { HashMap<ObjectName, DynamicMBean> map = new HashMap<>(); DiagnosticCommandMBean diagMBean = getDiagnosticCommandMBean(); if (diagMBean != null) { map.put(Util.newObjectName(HOTSPOT_DIAGNOSTIC_COMMAND_MBEAN_NAME), diagMBean); } return map; }
Example #20
Source File: RedefineMethodInBacktraceApp.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
private void doMethodInBacktraceTestB() throws Exception { // Start a thread which blocks in method Thread t = new Thread(RedefineMethodInBacktraceTargetB::methodToRedefine); t.setDaemon(true); t.start(); // Wait here until the new thread is in the method we want to redefine called.await(); // Now redefine the class while the method is still on the stack of the new thread doRedefine(RedefineMethodInBacktraceTargetB.class); // Do thread dumps in two different ways (to exercise different code paths) // while the old class is still on the stack 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(); }
Example #21
Source File: ManagementFactoryHelper.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public static synchronized DiagnosticCommandMBean getDiagnosticCommandMBean() { // Remote Diagnostic Commands may not be supported if (hsDiagCommandMBean == null && jvm.isRemoteDiagnosticCommandsSupported()) { hsDiagCommandMBean = new DiagnosticCommandImpl(jvm); } return hsDiagCommandMBean; }
Example #22
Source File: ManagementFactoryHelper.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public static HashMap<ObjectName, DynamicMBean> getPlatformDynamicMBeans() { HashMap<ObjectName, DynamicMBean> map = new HashMap<>(); DiagnosticCommandMBean diagMBean = getDiagnosticCommandMBean(); if (diagMBean != null) { map.put(Util.newObjectName(HOTSPOT_DIAGNOSTIC_COMMAND_MBEAN_NAME), diagMBean); } return map; }
Example #23
Source File: ManagementFactoryHelper.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
public static HashMap<ObjectName, DynamicMBean> getPlatformDynamicMBeans() { HashMap<ObjectName, DynamicMBean> map = new HashMap<>(); DiagnosticCommandMBean diagMBean = getDiagnosticCommandMBean(); if (diagMBean != null) { map.put(Util.newObjectName(HOTSPOT_DIAGNOSTIC_COMMAND_MBEAN_NAME), diagMBean); } return map; }
Example #24
Source File: RedefineMethodInBacktraceApp.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
private void doMethodInBacktraceTestB() throws Exception { // Start a thread which blocks in method Thread t = new Thread(RedefineMethodInBacktraceTargetB::methodToRedefine); t.setDaemon(true); t.start(); // Wait here until the new thread is in the method we want to redefine called.await(); // Now redefine the class while the method is still on the stack of the new thread doRedefine(RedefineMethodInBacktraceTargetB.class); // Do thread dumps in two different ways (to exercise different code paths) // while the old class is still on the stack 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(); }
Example #25
Source File: ManagementFactoryHelper.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
public static synchronized DiagnosticCommandMBean getDiagnosticCommandMBean() { // Remote Diagnostic Commands may not be supported if (hsDiagCommandMBean == null && jvm.isRemoteDiagnosticCommandsSupported()) { hsDiagCommandMBean = new DiagnosticCommandImpl(jvm); } return hsDiagCommandMBean; }
Example #26
Source File: ManagementFactoryHelper.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
public static synchronized DiagnosticCommandMBean getDiagnosticCommandMBean() { // Remote Diagnostic Commands may not be supported if (hsDiagCommandMBean == null && jvm.isRemoteDiagnosticCommandsSupported()) { hsDiagCommandMBean = new DiagnosticCommandImpl(jvm); } return hsDiagCommandMBean; }
Example #27
Source File: ManagementFactoryHelper.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
public static HashMap<ObjectName, DynamicMBean> getPlatformDynamicMBeans() { HashMap<ObjectName, DynamicMBean> map = new HashMap<>(); DiagnosticCommandMBean diagMBean = getDiagnosticCommandMBean(); if (diagMBean != null) { map.put(Util.newObjectName(HOTSPOT_DIAGNOSTIC_COMMAND_MBEAN_NAME), diagMBean); } return map; }
Example #28
Source File: RedefineMethodInBacktraceApp.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 5 votes |
private void doMethodInBacktraceTestB() throws Exception { // Start a thread which blocks in method Thread t = new Thread(RedefineMethodInBacktraceTargetB::methodToRedefine); t.setDaemon(true); t.start(); // Wait here until the new thread is in the method we want to redefine called.await(); // Now redefine the class while the method is still on the stack of the new thread doRedefine(RedefineMethodInBacktraceTargetB.class); // Do thread dumps in two different ways (to exercise different code paths) // while the old class is still on the stack 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(); }
Example #29
Source File: RedefineMethodInBacktraceApp.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
private void doMethodInBacktraceTestB() throws Exception { // Start a thread which blocks in method Thread t = new Thread(RedefineMethodInBacktraceTargetB::methodToRedefine); t.setDaemon(true); t.start(); // Wait here until the new thread is in the method we want to redefine called.await(); // Now redefine the class while the method is still on the stack of the new thread doRedefine(RedefineMethodInBacktraceTargetB.class); // Do thread dumps in two different ways (to exercise different code paths) // while the old class is still on the stack 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(); }
Example #30
Source File: RedefineMethodInBacktraceApp.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private void doMethodInBacktraceTestB() throws Exception { // Start a thread which blocks in method Thread t = new Thread(RedefineMethodInBacktraceTargetB::methodToRedefine); t.setDaemon(true); t.start(); // Wait here until the new thread is in the method we want to redefine called.await(); // Now redefine the class while the method is still on the stack of the new thread doRedefine(RedefineMethodInBacktraceTargetB.class); // Do thread dumps in two different ways (to exercise different code paths) // while the old class is still on the stack 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(); }