• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java DiagnosticCommandMBean类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.sun.management.DiagnosticCommandMBean的典型用法代码示例。如果您正苦于以下问题:Java DiagnosticCommandMBean类的具体用法?Java DiagnosticCommandMBean怎么用?Java DiagnosticCommandMBean使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DiagnosticCommandMBean类属于com.sun.management包,在下文中一共展示了DiagnosticCommandMBean类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: executeDcmd

import com.sun.management.DiagnosticCommandMBean; //导入依赖的package包/类
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;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:20,代码来源:NMTHelper.java


示例2: executeDcmd

import com.sun.management.DiagnosticCommandMBean; //导入依赖的package包/类
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;
}
 
开发者ID:RedlineResearch,项目名称:OLD-OpenJDK8,代码行数:20,代码来源:NMTHelper.java


示例3: getDiagnosticCommandMBean

import com.sun.management.DiagnosticCommandMBean; //导入依赖的package包/类
public static synchronized DiagnosticCommandMBean getDiagnosticCommandMBean() {
    // Remote Diagnostic Commands may not be supported
    if (hsDiagCommandMBean == null && jvm.isRemoteDiagnosticCommandsSupported()) {
        hsDiagCommandMBean = new DiagnosticCommandImpl(jvm);
    }
    return hsDiagCommandMBean;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:8,代码来源:ManagementFactoryHelper.java


示例4: getPlatformDynamicMBeans

import com.sun.management.DiagnosticCommandMBean; //导入依赖的package包/类
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;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:ManagementFactoryHelper.java


示例5: doMethodInBacktraceTestB

import com.sun.management.DiagnosticCommandMBean; //导入依赖的package包/类
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();
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:30,代码来源:RedefineMethodInBacktraceApp.java


示例6: getDiagnosticCommandMBean

import com.sun.management.DiagnosticCommandMBean; //导入依赖的package包/类
static synchronized DiagnosticCommandMBean getDiagnosticCommandMBean() {
    VMManagement jvm = ManagementFactoryHelper.getVMManagement();

    // Remote Diagnostic Commands may not be supported
    if (diagCommandMBean == null && jvm.isRemoteDiagnosticCommandsSupported()) {
        diagCommandMBean = new DiagnosticCommandImpl(jvm);
    }
    return diagCommandMBean;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:10,代码来源:DiagnosticCommandImpl.java


示例7: referenceClassInDirectAndTransitiveDependency

import com.sun.management.DiagnosticCommandMBean; //导入依赖的package包/类
ClassInDirectDependency referenceClassInDirectAndTransitiveDependency(
  ClassInTransitiveDependency referenceToClassInTransitiveDependency, double d, Float f, X string) {
  final ClassInTransitiveDependency localReference = referenceToClassInTransitiveDependency;

  try {
    final Long longValue = someTee(Long.class);
  } catch (SQLException e) {
    //
  }

  // types that should come from runtime's rt.jar
  final DataSource dataSource = null;
  final DataSource secondDataSource = null;
  final DataSource thirdDataSource = null;
  final Text text = null;
  final DiagnosticCommandMBean dcmb = null;

  final int k = 3 + 4;

  final Date date = new Date(System.currentTimeMillis());

  float m = Math.max(1, 2);

  final Class<String[]> stringArrayClass = String[].class;
  final Class<Long[][]> longArrayArrayClass = Long[][].class;

  final ClassInDirectDependency directDependency = new ClassInDirectDependency();
  final String s = String.valueOf(directDependency.getOne());
  return directDependency;
}
 
开发者ID:ImmobilienScout24,项目名称:illegal-transitive-dependency-check,代码行数:31,代码来源:ClassInMavenProjectSource.java



注:本文中的com.sun.management.DiagnosticCommandMBean类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java QJournalProtocol类代码示例发布时间:2022-05-22
下一篇:
Java ClassPathProvider类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap