Java Code Examples for sun.management.ManagementFactoryHelper#getCompilationMXBean()

The following examples show how to use sun.management.ManagementFactoryHelper#getCompilationMXBean() . 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: CompilerWhiteBoxTest.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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();
}
 
Example 2
Source File: CompilerWhiteBoxTest.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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();
}
 
Example 3
Source File: CompilerWhiteBoxTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 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();
}
 
Example 4
Source File: CompileTheWorld.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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();
        }
    }
}
 
Example 5
Source File: CompileTheWorld.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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();
        }
    }
}
 
Example 6
Source File: CompileTheWorld.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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();
        }
    }
}
 
Example 7
Source File: CompileTheWorld.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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();
        }
    }
}
 
Example 8
Source File: CompileTheWorld.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * 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();
        }
    }
}
 
Example 9
Source File: ManagementFactory.java    From openjdk-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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();
}
 
Example 10
Source File: ManagementFactory.java    From hottub with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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();
}
 
Example 11
Source File: ManagementFactory.java    From jdk8u-dev-jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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();
}
 
Example 12
Source File: ManagementFactory.java    From jdk8u-jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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();
}
 
Example 13
Source File: ManagementFactory.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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();
}
 
Example 14
Source File: ManagementFactory.java    From jdk8u_jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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();
}
 
Example 15
Source File: ManagementFactory.java    From openjdk-jdk8u with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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();
}
 
Example 16
Source File: ManagementFactory.java    From jdk-1.7-annotated with Apache License 2.0 2 votes vote down vote up
/**
 * 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();
}
 
Example 17
Source File: ManagementFactory.java    From JDKSourceCode1.8 with MIT License 2 votes vote down vote up
/**
 * 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();
}
 
Example 18
Source File: ManagementFactory.java    From jdk8u60 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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();
}
 
Example 19
Source File: ManagementFactory.java    From TencentKona-8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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();
}
 
Example 20
Source File: ManagementFactory.java    From dragonwell8_jdk with GNU General Public License v2.0 2 votes vote down vote up
/**
 * 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();
}