当前位置: 首页>>代码示例>>Java>>正文


Java HotSpotDiagnosticMXBean.getVMOption方法代码示例

本文整理汇总了Java中com.sun.management.HotSpotDiagnosticMXBean.getVMOption方法的典型用法代码示例。如果您正苦于以下问题:Java HotSpotDiagnosticMXBean.getVMOption方法的具体用法?Java HotSpotDiagnosticMXBean.getVMOption怎么用?Java HotSpotDiagnosticMXBean.getVMOption使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.management.HotSpotDiagnosticMXBean的用法示例。


在下文中一共展示了HotSpotDiagnosticMXBean.getVMOption方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkVMOption

import com.sun.management.HotSpotDiagnosticMXBean; //导入方法依赖的package包/类
private static void checkVMOption(HotSpotDiagnosticMXBean mbean) {
    VMOption option = mbean.getVMOption(PRINT_GC_DETAILS);
    if (!option.getValue().equalsIgnoreCase(EXPECTED_VALUE)) {
        throw new RuntimeException("Unexpected value: " +
            option.getValue() + " expected: " + EXPECTED_VALUE);
    }
    boolean iae = false;
    try {
        mbean.getVMOption(BAD_OPTION);
    } catch (IllegalArgumentException e) {
        iae = true;
    }
    if (!iae) {
        throw new RuntimeException("Invalid VM Option" +
            " was not detected");
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:18,代码来源:GetVMOption.java

示例2: main

import com.sun.management.HotSpotDiagnosticMXBean; //导入方法依赖的package包/类
public static void main(String... args) throws Exception {
    MBeanServerConnection msc = ManagementFactory.getPlatformMBeanServer();
    HotSpotDiagnosticMXBean mxbean =
        ManagementFactory.getPlatformMXBean(msc, HotSpotDiagnosticMXBean.class);


    String[] signatures = new String[] {
        String.class.getName()
    };
    Object obj = msc.invoke(mxbean.getObjectName(), "getVMOption",
        new String[] { "PrintVMOptions"}, signatures);

    CompositeData data = (CompositeData)obj;
    validateType(data);

    VMOption option = mxbean.getVMOption("PrintVMOptions");
    VMOption o = VMOption.from(data);
    assertEquals(option, o);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:VMOptionOpenDataTest.java

示例3: checkVMOption

import com.sun.management.HotSpotDiagnosticMXBean; //导入方法依赖的package包/类
private static void checkVMOption(HotSpotDiagnosticMXBean mbean) {
    VMOption option = mbean.getVMOption(HEAP_DUMP_ON_OOM);
    if (!option.getValue().equalsIgnoreCase(EXPECTED_VALUE)) {
        throw new RuntimeException("Unexpected value: " +
            option.getValue() + " expected: " + EXPECTED_VALUE);
    }
    boolean iae = false;
    try {
        mbean.getVMOption(BAD_OPTION);
    } catch (IllegalArgumentException e) {
        iae = true;
    }
    if (!iae) {
        throw new RuntimeException("Invalid VM Option" +
            " was not detected");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:GetVMOption.java

示例4: getVMOption

import com.sun.management.HotSpotDiagnosticMXBean; //导入方法依赖的package包/类
/**
 * Returns value of VM option.
 *
 * @param name option's name
 * @return value of option or {@code null}, if option doesn't exist
 * @throws NullPointerException if name is null
 */
protected static String getVMOption(String name) {
    Objects.requireNonNull(name);
    HotSpotDiagnosticMXBean diagnostic
            = ManagementFactoryHelper.getDiagnosticMXBean();
    VMOption tmp;
    try {
        tmp = diagnostic.getVMOption(name);
    } catch (IllegalArgumentException e) {
        tmp = null;
    }
    return (tmp == null ? null : tmp.getValue());
}
 
开发者ID:arodchen,项目名称:MaxSim,代码行数:20,代码来源:CompilerWhiteBoxTest.java

示例5: getCompressedClassSpaceSize

import com.sun.management.HotSpotDiagnosticMXBean; //导入方法依赖的package包/类
private static long getCompressedClassSpaceSize() {
  HotSpotDiagnosticMXBean diagnostic =
      ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class);

  VMOption option = diagnostic.getVMOption("CompressedClassSpaceSize");
  return Long.parseLong(option.getValue());
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:TestUseCompressedOopsErgoTools.java

示例6: checkVMOption

import com.sun.management.HotSpotDiagnosticMXBean; //导入方法依赖的package包/类
private static void checkVMOption(HotSpotDiagnosticMXBean mbean) {
    VMOption option = mbean.getVMOption(COMPILE_THRESHOLD_SCALING);
    if (!option.getValue().equalsIgnoreCase(EXPECTED_VALUE)) {
        throw new RuntimeException("Unexpected value: " +
            option.getValue() + " expected: " + EXPECTED_VALUE);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:GetDoubleVMOption.java

示例7: main

import com.sun.management.HotSpotDiagnosticMXBean; //导入方法依赖的package包/类
public static void main(String[] args) {
    HotSpotDiagnosticMXBean hsd = ManagementFactoryHelper.getDiagnosticMXBean();

    // 打印虚拟机的某个配置参数的值
    VMOption vmo = hsd.getVMOption("UseCompressedOops");
    System.out.println(vmo.getName() + " | " + vmo.getValue());

    hsd.getDiagnosticOptions().stream().forEach(System.out::println);
}
 
开发者ID:walle-liao,项目名称:jaf-examples,代码行数:10,代码来源:PrintVmOptions.java

示例8: testingG1GC

import com.sun.management.HotSpotDiagnosticMXBean; //导入方法依赖的package包/类
public static boolean testingG1GC() {
    HotSpotDiagnosticMXBean diagnostic = ManagementFactoryHelper.getDiagnosticMXBean();

    VMOption option = diagnostic.getVMOption("UseG1GC");
    if (option.getValue().equals("false")) {
      System.out.println("Skipping this test. It is only a G1 test.");
      return false;
    }
    return true;
}
 
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:11,代码来源:TestSummarizeRSetStatsTools.java

示例9: main

import com.sun.management.HotSpotDiagnosticMXBean; //导入方法依赖的package包/类
public static void main(String[] args) {
  HotSpotDiagnosticMXBean diagnostic = ManagementFactoryHelper.getDiagnosticMXBean();

  String expectedValue = getExpectedValue(args);
  VMOption option = diagnostic.getVMOption("G1HeapRegionSize");
  if (!expectedValue.equals(option.getValue())) {
    throw new RuntimeException("Wrong value for G1HeapRegionSize. Expected " + expectedValue + " but got " + option.getValue());
  }
}
 
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:10,代码来源:TestG1HeapRegionSize.java

示例10: main

import com.sun.management.HotSpotDiagnosticMXBean; //导入方法依赖的package包/类
public static void main(String[] args) {
  HotSpotDiagnosticMXBean diagnostic = ManagementFactoryHelper.getDiagnosticMXBean();

  VMOption option = diagnostic.getVMOption("UseG1GC");
  if (option.getValue().equals("false")) {
    System.out.println("Skipping this test. It is only a G1 test.");
    return;
  }

  String expectedValue = getExpectedValue(args);
  option = diagnostic.getVMOption("G1HeapRegionSize");
  if (!expectedValue.equals(option.getValue())) {
    throw new RuntimeException("Wrong value for G1HeapRegionSize. Expected " + expectedValue + " but got " + option.getValue());
  }
}
 
开发者ID:infobip,项目名称:infobip-open-jdk-8,代码行数:16,代码来源:TestG1HeapRegionSize.java

示例11: getCompressedClassSpaceSize

import com.sun.management.HotSpotDiagnosticMXBean; //导入方法依赖的package包/类
private static long getCompressedClassSpaceSize() {
  HotSpotDiagnosticMXBean diagnostic = ManagementFactoryHelper.getDiagnosticMXBean();

  VMOption option = diagnostic.getVMOption("CompressedClassSpaceSize");
  return Long.parseLong(option.getValue());
}
 
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:7,代码来源:TestUseCompressedOopsErgoTools.java


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