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


Java ManagementFactoryHelper.getCompilationMXBean方法代码示例

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


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

示例1: runTest

import sun.management.ManagementFactoryHelper; //导入方法依赖的package包/类
/**
 * Template method for testing. Prints tested method's info before
 * {@linkplain #test()} and after {@linkplain #test()} or on thrown
 * exception.
 *
 * @throws RuntimeException if method {@linkplain #test()} throws any
 *                          exception
 * @see #test()
 */
protected final void runTest() {
    if (ManagementFactoryHelper.getCompilationMXBean() == null) {
        System.err.println(
                "Warning: test is not applicable in interpreted mode");
        return;
    }
    System.out.println("at test's start:");
    printInfo();
    try {
        test();
    } catch (Exception e) {
        System.out.printf("on exception '%s':", e.getMessage());
        printInfo();
        e.printStackTrace();
        if (e instanceof RuntimeException) {
            throw (RuntimeException) e;
        }
        throw new RuntimeException(e);
    }
    System.out.println("at test's end:");
    printInfo();
}
 
开发者ID:arodchen,项目名称:MaxSim,代码行数:32,代码来源:CompilerWhiteBoxTest.java

示例2: main

import sun.management.ManagementFactoryHelper; //导入方法依赖的package包/类
/**
 * Entry point. Compiles classes in {@code args}, or all classes in
 * boot-classpath if args is empty
 *
 * @param args paths to jar/zip, dir contains classes, or to .lst file
 *             contains list of classes to compile
 */
public static void main(String[] args) {
    String logfile = Utils.LOG_FILE;
    PrintStream os = null;
    if (logfile != null) {
        try {
            os = new PrintStream(Files.newOutputStream(Paths.get(logfile)));
        } catch (IOException io) {
        }
    }
    if (os != null) {
        System.setOut(os);
    }

    try {
        try {
            if (ManagementFactoryHelper.getCompilationMXBean() == null) {
                throw new RuntimeException(
                        "CTW can not work in interpreted mode");
            }
        } catch (java.lang.NoClassDefFoundError e) {
            // compact1, compact2 support
        }
        String[] paths = args;
        boolean skipRtJar = false;
        if (args.length == 0) {
            paths = getDefaultPaths();
            skipRtJar = true;
        }
        ExecutorService executor = createExecutor();
        long start = System.currentTimeMillis();
        try {
            String path;
            for (int i = 0, n = paths.length; i < n
                    && !PathHandler.isFinished(); ++i) {
                path = paths[i];
                if (skipRtJar && i > 0 && isRtJar(path)) {
                    // rt.jar is not first, so skip it
                    continue;
                }
                PathHandler.create(path, executor).process();
            }
        } finally {
            await(executor);
        }
        System.out.printf("Done (%d classes, %d methods, %d ms)%n",
                Compiler.getClassCount(),
                Compiler.getMethodCount(),
                System.currentTimeMillis() - start);
    } finally {
        if (os != null) {
            os.close();
        }
    }
}
 
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:62,代码来源:CompileTheWorld.java

示例3: getCompilationMXBean

import sun.management.ManagementFactoryHelper; //导入方法依赖的package包/类
/**
 * Returns the managed bean for the compilation system of
 * the Java virtual machine.  This method returns <tt>null</tt>
 * if the Java virtual machine has no compilation system.
 *
 * @return a {@link CompilationMXBean} object for the Java virtual
 *   machine or <tt>null</tt> if the Java virtual machine has
 *   no compilation system.
 */
public static CompilationMXBean getCompilationMXBean() {
    return ManagementFactoryHelper.getCompilationMXBean();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:ManagementFactory.java


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