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


Java Connector.StringArgument方法代码示例

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


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

示例1: tryDebug

import com.sun.jdi.connect.Connector; //导入方法依赖的package包/类
private static void tryDebug(long pid) throws IOException,
        IllegalConnectorArgumentsException {
    AttachingConnector ac = Bootstrap.virtualMachineManager().attachingConnectors()
            .stream()
            .filter(c -> c.name().equals("com.sun.jdi.ProcessAttach"))
            .findFirst()
            .orElseThrow(() -> new RuntimeException("Unable to locate ProcessAttachingConnector"));

    Map<String, Connector.Argument> args = ac.defaultArguments();
    Connector.StringArgument arg = (Connector.StringArgument) args
            .get("pid");
    arg.setValue("" + pid);

    System.out.println("Debugger is attaching to: " + pid + " ...");
    VirtualMachine vm = ac.attach(args);

    // list all threads
    System.out.println("Attached! Now listing threads ...");
    vm.allThreads().stream().forEach(System.out::println);

    System.out.println("Debugger done.");
    vm.dispose();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:24,代码来源:ProcessAttachTest.java

示例2: connect

import com.sun.jdi.connect.Connector; //导入方法依赖的package包/类
@BeforeClass
public static void connect() throws Exception {
    SocketAttachingConnector socketConnector = null;
    for (Connector connector : Bootstrap.virtualMachineManager().allConnectors()) {
        if (connector instanceof SocketAttachingConnector) {
            socketConnector = (SocketAttachingConnector) connector;
        }
    }
    if (socketConnector == null) {
        throw new RuntimeException("Failed to find SocketAttachingConnector");
    }

    Map<String, ? extends Connector.Argument> args = socketConnector.defaultArguments();
    Connector.IntegerArgument port = (Connector.IntegerArgument) args.get("port");
    port.setValue(PORT);

    Connector.StringArgument hostname = (Connector.StringArgument) args.get("hostname");
    hostname.setValue("localhost");

    virtualMachine = socketConnector.attach(args);
}
 
开发者ID:mnip91,项目名称:proactive-component-monitoring,代码行数:22,代码来源:TestHeartbeat.java

示例3: main

import com.sun.jdi.connect.Connector; //导入方法依赖的package包/类
public static void main(String main_args[]) throws Exception {
    String pid = main_args[0];

    // find ProcessAttachingConnector

    List<AttachingConnector> l =
        Bootstrap.virtualMachineManager().attachingConnectors();
    AttachingConnector ac = null;
    for (AttachingConnector c: l) {
        if (c.name().equals("com.sun.jdi.ProcessAttach")) {
            ac = c;
            break;
        }
    }
    if (ac == null) {
        throw new RuntimeException("Unable to locate ProcessAttachingConnector");
    }

    Map<String,Connector.Argument> args = ac.defaultArguments();
    Connector.StringArgument arg = (Connector.StringArgument)args.get("pid");
    arg.setValue(pid);

    System.out.println("Debugger is attaching to: " + pid + " ...");

    VirtualMachine vm = ac.attach(args);

    System.out.println("Attached! Now listing threads ...");

    // list all threads

    for (ThreadReference thr: vm.allThreads()) {
        System.out.println(thr);
    }

    System.out.println("Debugger done.");
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:37,代码来源:ProcessAttachDebugger.java

示例4: launchVM

import com.sun.jdi.connect.Connector; //导入方法依赖的package包/类
protected VirtualMachine launchVM() {
    F3LaunchingConnector conn = new F3LaunchingConnector();
    Map<String, Connector.Argument> args = conn.defaultArguments();
    Connector.StringArgument arg = (Connector.StringArgument) args.get("main");
    // dummy main class
    arg.setValue("Main");
    try {
        return conn.launch(args);
    } catch (Exception exp) {
        throw new RuntimeException(exp);
    }
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:13,代码来源:JDITestBase.java


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