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


Java JDKToolLauncher.addVMArg方法代码示例

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


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

示例1: jps

import jdk.testlibrary.JDKToolLauncher; //导入方法依赖的package包/类
/**
 * Start jps utility with VM args and tool arguments
 */
public static OutputAnalyzer jps(List<String> vmArgs, List<String> toolArgs) throws Exception {
    JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jps");
    if (vmArgs != null) {
        for (String vmArg : vmArgs) {
            launcher.addVMArg(vmArg);
        }
    }
    if (toolArgs != null) {
        for (String toolArg : toolArgs) {
            launcher.addToolArg(toolArg);
        }
    }

    ProcessBuilder processBuilder = new ProcessBuilder(launcher.getCommand());
    System.out.println(Arrays.toString(processBuilder.command().toArray()).replace(",", ""));
    OutputAnalyzer output = new OutputAnalyzer(processBuilder.start());
    System.out.println(output.getOutput());

    return output;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:24,代码来源:JpsHelper.java

示例2: runJps

import jdk.testlibrary.JDKToolLauncher; //导入方法依赖的package包/类
/**
 * Depending on test settings command line can look like:
 *
 * jps -J-XX:+UsePerfData hostname
 * jps -J-XX:+UsePerfData hostname:port
 * jps -J-XX:+UsePerfData hostname/serverName
 * jps -J-XX:+UsePerfData hostname:port/serverName
 */
private OutputAnalyzer runJps() throws Exception {
    JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jps");
    launcher.addVMArg("-XX:+UsePerfData");
    // Run jps with -v flag to obtain -Dparent.pid.<pid>
    launcher.addToolArg("-v");
    launcher.addToolArg(getDestination());

    String[] cmd = launcher.getCommand();
    log("Start jps", cmd);

    ProcessBuilder processBuilder = new ProcessBuilder(cmd);
    OutputAnalyzer output = new OutputAnalyzer(processBuilder.start());
    System.out.println(output.getOutput());

    return output;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:25,代码来源:JstatdTest.java

示例3: runJstat

import jdk.testlibrary.JDKToolLauncher; //导入方法依赖的package包/类
/**
 * Depending on test settings command line can look like:
 *
 * jstat -J-XX:+UsePerfData -J-Duser.language=en -gcutil [email protected] 250 5
 * jstat -J-XX:+UsePerfData -J-Duser.language=en -gcutil [email protected]:port 250 5
 * jstat -J-XX:+UsePerfData -J-Duser.language=en -gcutil [email protected]/serverName 250 5
 * jstat -J-XX:+UsePerfData -J-Duser.language=en -gcutil [email protected]:port/serverName 250 5
 */
private OutputAnalyzer runJstat() throws Exception {
    JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jstat");
    launcher.addVMArg("-XX:+UsePerfData");
    launcher.addVMArg("-Duser.language=en");
    launcher.addToolArg("-gcutil");
    launcher.addToolArg(jstatdPid + "@" + getDestination());
    launcher.addToolArg(Integer.toString(JSTAT_GCUTIL_INTERVAL_MS));
    launcher.addToolArg(Integer.toString(JSTAT_GCUTIL_SAMPLES));

    String[] cmd = launcher.getCommand();
    log("Start jstat", cmd);

    ProcessBuilder processBuilder = new ProcessBuilder(cmd);
    OutputAnalyzer output = new OutputAnalyzer(processBuilder.start());
    System.out.println(output.getOutput());

    return output;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:27,代码来源:JstatdTest.java

示例4: getJstatdCmd

import jdk.testlibrary.JDKToolLauncher; //导入方法依赖的package包/类
/**
 * Depending on test settings command line can look like:
 *
 * jstatd -J-XX:+UsePerfData -J-Djava.security.policy=all.policy
 * jstatd -J-XX:+UsePerfData -J-Djava.security.policy=all.policy -p port
 * jstatd -J-XX:+UsePerfData -J-Djava.security.policy=all.policy -n serverName
 * jstatd -J-XX:+UsePerfData -J-Djava.security.policy=all.policy -p port -n serverName
 */
private String[] getJstatdCmd() throws Exception {
    JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jstatd");
    launcher.addVMArg("-XX:+UsePerfData");
    String testSrc = System.getProperty("test.src");
    File policy = new File(testSrc, "all.policy");
    assertTrue(policy.exists() && policy.isFile(),
            "Security policy " + policy.getAbsolutePath() + " does not exist or not a file");
    launcher.addVMArg("-Djava.security.policy=" + policy.getAbsolutePath());
    // -Dparent.pid.<pid> will help to identify jstad process started by this test
    launcher.addVMArg("-Dparent.pid." + ProcessTools.getProcessId());
    if (port != null) {
        launcher.addToolArg("-p");
        launcher.addToolArg(port);
    }
    if (serverName != null) {
        launcher.addToolArg("-n");
        launcher.addToolArg(serverName);
    }

    String[] cmd = launcher.getCommand();
    log("Start jstatd", cmd);
    return cmd;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:32,代码来源:JstatdTest.java

示例5: jps

import jdk.testlibrary.JDKToolLauncher; //导入方法依赖的package包/类
/**
 * Start jps utility with VM args and tool arguments
 */
public static OutputAnalyzer jps(List<String> vmArgs, List<String> toolArgs) throws Exception {
    JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jps");
    launcher.addVMArg("-XX:+UsePerfData");
    if (vmArgs != null) {
        for (String vmArg : vmArgs) {
            launcher.addVMArg(vmArg);
        }
    }
    if (toolArgs != null) {
        for (String toolArg : toolArgs) {
            launcher.addToolArg(toolArg);
        }
    }

    ProcessBuilder processBuilder = new ProcessBuilder(launcher.getCommand());
    System.out.println(Arrays.toString(processBuilder.command().toArray()).replace(",", ""));
    OutputAnalyzer output = ProcessTools.executeProcess(processBuilder);
    System.out.println(output.getOutput());

    return output;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:25,代码来源:JpsHelper.java

示例6: jstack

import jdk.testlibrary.JDKToolLauncher; //导入方法依赖的package包/类
private static OutputAnalyzer jstack(String... toolArgs) throws Exception {
    JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jstack");
    launcher.addVMArg("-XX:+UsePerfData");
    if (toolArgs != null) {
        for (String toolArg : toolArgs) {
            launcher.addToolArg(toolArg);
        }
    }

    processBuilder.command(launcher.getCommand());
    System.out.println(processBuilder.command().stream().collect(Collectors.joining(" ")));
    OutputAnalyzer output = ProcessTools.executeProcess(processBuilder);
    System.out.println(output.getOutput());

    return output;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:DeadlockDetectionTest.java

示例7: jstack

import jdk.testlibrary.JDKToolLauncher; //导入方法依赖的package包/类
private static OutputAnalyzer jstack(String... toolArgs) throws Exception {
    JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jstack");
    launcher.addVMArg("-XX:+UsePerfData");
    if (toolArgs != null) {
        for (String toolArg : toolArgs) {
            launcher.addToolArg(toolArg);
        }
    }
    launcher.addToolArg(Long.toString(ProcessTools.getProcessId()));

    processBuilder.command(launcher.getCommand());
    System.out.println(Arrays.toString(processBuilder.command().toArray()).replace(",", ""));
    OutputAnalyzer output = ProcessTools.executeProcess(processBuilder);
    System.out.println(output.getOutput());

    return output;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:BasicJStackTest.java

示例8: runJstat

import jdk.testlibrary.JDKToolLauncher; //导入方法依赖的package包/类
/**
 * Depending on test settings command line can look like:
 *
 * jstat -J-XX:+UsePerfData -J-Duser.language=en -gcutil [email protected] 250 5
 * jstat -J-XX:+UsePerfData -J-Duser.language=en -gcutil [email protected]:port 250 5
 * jstat -J-XX:+UsePerfData -J-Duser.language=en -gcutil [email protected]/serverName 250 5
 * jstat -J-XX:+UsePerfData -J-Duser.language=en -gcutil [email protected]:port/serverName 250 5
 */
private OutputAnalyzer runJstat() throws Exception {
    JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jstat");
    launcher.addVMArg("-XX:+UsePerfData");
    launcher.addVMArg("-Duser.language=en");
    launcher.addToolArg("-gcutil");
    launcher.addToolArg(jstatdPid + "@" + getDestination());
    launcher.addToolArg(Integer.toString(JSTAT_GCUTIL_INTERVAL_MS));
    launcher.addToolArg(Integer.toString(JSTAT_GCUTIL_SAMPLES));

    String[] cmd = launcher.getCommand();
    log("Start jstat", cmd);

    ProcessBuilder processBuilder = new ProcessBuilder(cmd);
    OutputAnalyzer output = ProcessTools.executeProcess(processBuilder);
    System.out.println(output.getOutput());

    return output;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:27,代码来源:JstatdTest.java

示例9: getJstatdCmd

import jdk.testlibrary.JDKToolLauncher; //导入方法依赖的package包/类
/**
 * Depending on test settings command line can look like:
 *
 * jstatd -J-XX:+UsePerfData -J-Djava.security.policy=all.policy
 * jstatd -J-XX:+UsePerfData -J-Djava.security.policy=all.policy -p port
 * jstatd -J-XX:+UsePerfData -J-Djava.security.policy=all.policy -n serverName
 * jstatd -J-XX:+UsePerfData -J-Djava.security.policy=all.policy -p port -n serverName
 */
private String[] getJstatdCmd() throws Exception {
    JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jstatd");
    launcher.addVMArg("-XX:+UsePerfData");
    String testSrc = System.getProperty("test.src");
    File policy = new File(testSrc, "all.policy");
    assertTrue(policy.exists() && policy.isFile(),
            "Security policy " + policy.getAbsolutePath() + " does not exist or not a file");
    launcher.addVMArg("-Djava.security.policy=" + policy.getAbsolutePath());
    if (port != null) {
        launcher.addToolArg("-p");
        launcher.addToolArg(port);
    }
    if (serverName != null) {
        launcher.addToolArg("-n");
        launcher.addToolArg(serverName);
    }
    if (withExternalRegistry) {
        launcher.addToolArg("-nr");
    }

    String[] cmd = launcher.getCommand();
    log("Start jstatd", cmd);
    return cmd;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:33,代码来源:JstatdTest.java

示例10: getJstatdCmd

import jdk.testlibrary.JDKToolLauncher; //导入方法依赖的package包/类
/**
 * Depending on test settings command line can look like:
 *
 * jstatd -J-XX:+UsePerfData -J-Djava.security.policy=all.policy
 * jstatd -J-XX:+UsePerfData -J-Djava.security.policy=all.policy -p port
 * jstatd -J-XX:+UsePerfData -J-Djava.security.policy=all.policy -n serverName
 * jstatd -J-XX:+UsePerfData -J-Djava.security.policy=all.policy -p port -n serverName
 */
private String[] getJstatdCmd() throws UnknownHostException {
    JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jstatd");
    launcher.addVMArg("-XX:+UsePerfData");
    String testSrc = System.getProperty("test.src");
    File policy = new File(testSrc, "all.policy");
    assertTrue(policy.exists() && policy.isFile(),
            "Security policy " + policy.getAbsolutePath() + " does not exist or not a file");
    launcher.addVMArg("-Djava.security.policy=" + policy.getAbsolutePath());
    if (port != null) {
        launcher.addToolArg("-p");
        launcher.addToolArg(port);
    }
    if (serverName != null) {
        launcher.addToolArg("-n");
        launcher.addToolArg(serverName);
    }

    String[] cmd = launcher.getCommand();
    log("Start jstatd", cmd);
    return cmd;
}
 
开发者ID:RedlineResearch,项目名称:OLD-OpenJDK8,代码行数:30,代码来源:JstatdTest.java

示例11: runJps

import jdk.testlibrary.JDKToolLauncher; //导入方法依赖的package包/类
/**
 * Depending on test settings command line can look like:
 *
 * jps -J-XX:+UsePerfData hostname
 * jps -J-XX:+UsePerfData hostname:port
 * jps -J-XX:+UsePerfData hostname/serverName
 * jps -J-XX:+UsePerfData hostname:port/serverName
 */
private OutputAnalyzer runJps() throws Exception {
    JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jps");
    launcher.addVMArg("-XX:+UsePerfData");
    launcher.addToolArg(getDestination());

    String[] cmd = launcher.getCommand();
    log("Start jps", cmd);

    ProcessBuilder processBuilder = new ProcessBuilder(cmd);
    OutputAnalyzer output = ProcessTools.executeProcess(processBuilder);
    System.out.println(output.getOutput());

    return output;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:23,代码来源:JstatdTest.java

示例12: runJps

import jdk.testlibrary.JDKToolLauncher; //导入方法依赖的package包/类
/**
 * Depending on test settings command line can look like:
 *
 * jps -J-XX:+UsePerfData hostname
 * jps -J-XX:+UsePerfData hostname:port
 * jps -J-XX:+UsePerfData hostname/serverName
 * jps -J-XX:+UsePerfData hostname:port/serverName
 */
private OutputAnalyzer runJps() throws Exception {
    JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jps");
    launcher.addVMArg("-XX:+UsePerfData");
    launcher.addToolArg(getDestination());

    String[] cmd = launcher.getCommand();
    log("Start jps", cmd);

    ProcessBuilder processBuilder = new ProcessBuilder(cmd);
    OutputAnalyzer output = new OutputAnalyzer(processBuilder.start());
    System.out.println(output.getOutput());

    return output;
}
 
开发者ID:RedlineResearch,项目名称:OLD-OpenJDK8,代码行数:23,代码来源:JstatdTest.java


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