com.sun.jdi.connect.spi.TransportService Java Examples

The following examples show how to use com.sun.jdi.connect.spi.TransportService. 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: SimpleLaunchingConnector.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public SimpleLaunchingConnector() {
    try {
        Class c = Class.forName("com.sun.tools.jdi.SocketTransportService");
        ts = (TransportService)c.newInstance();
    } catch (Exception x) {
        throw new Error(x);
    }
}
 
Example #2
Source File: SimpleLaunchingConnector.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
public VirtualMachine launch(Map<String, ? extends Connector.Argument> arguments) throws
                          IOException,
                          IllegalConnectorArgumentsException,
                          VMStartException {

    /*
     * Get the class name that we are to execute
     */
    String className = ((StringArgumentImpl)arguments.get(ARG_NAME)).value();
    if (className.length() == 0) {
        throw new IllegalConnectorArgumentsException("class name missing", ARG_NAME);
    }

    /*
     * Listen on an emperical port; launch the debuggee; wait for
     * for the debuggee to connect; stop listening;
     */
    TransportService.ListenKey key = ts.startListening();

    String exe = System.getProperty("java.home") + File.separator + "bin" +
        File.separator + "java";
    String cmd = exe + " -Xdebug -Xrunjdwp:transport=dt_socket,timeout=15000,address=" +
        key.address() +
        " -classpath " + System.getProperty("test.classes") +
        " " + className;
    Process process = Runtime.getRuntime().exec(cmd);
    Connection conn = ts.accept(key, 30*1000, 9*1000);
    ts.stopListening(key);

    /*
     * Debugee is connected - return the virtual machine mirror
     */
    return Bootstrap.virtualMachineManager().createVirtualMachine(conn);
}
 
Example #3
Source File: SimpleLaunchingConnector.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
public SimpleLaunchingConnector() {
    try {
        Class c = Class.forName("com.sun.tools.jdi.SocketTransportService");
        ts = (TransportService)c.newInstance();
    } catch (Exception x) {
        throw new Error(x);
    }
}
 
Example #4
Source File: SimpleLaunchingConnector.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public VirtualMachine launch(Map<String, ? extends Connector.Argument> arguments) throws
                          IOException,
                          IllegalConnectorArgumentsException,
                          VMStartException {

    /*
     * Get the class name that we are to execute
     */
    String className = ((StringArgumentImpl)arguments.get(ARG_NAME)).value();
    if (className.length() == 0) {
        throw new IllegalConnectorArgumentsException("class name missing", ARG_NAME);
    }

    /*
     * Listen on an emperical port; launch the debuggee; wait for
     * for the debuggee to connect; stop listening;
     */
    TransportService.ListenKey key = ts.startListening();

    String exe = System.getProperty("java.home") + File.separator + "bin" +
        File.separator + "java";
    String cmd = exe + " -Xdebug -Xrunjdwp:transport=dt_socket,timeout=15000,address=" +
        key.address() +
        " -classpath " + System.getProperty("test.classes") +
        " " + className;
    Process process = Runtime.getRuntime().exec(cmd);
    Connection conn = ts.accept(key, 30*1000, 9*1000);
    ts.stopListening(key);

    /*
     * Debugee is connected - return the virtual machine mirror
     */
    return Bootstrap.virtualMachineManager().createVirtualMachine(conn);
}
 
Example #5
Source File: SimpleLaunchingConnector.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public SimpleLaunchingConnector() {
    try {
        Class c = Class.forName("com.sun.tools.jdi.SocketTransportService");
        ts = (TransportService)c.newInstance();
    } catch (Exception x) {
        throw new Error(x);
    }
}
 
Example #6
Source File: SimpleLaunchingConnector.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public VirtualMachine launch(Map<String, ? extends Connector.Argument> arguments) throws
                          IOException,
                          IllegalConnectorArgumentsException,
                          VMStartException {

    /*
     * Get the class name that we are to execute
     */
    String className = ((StringArgumentImpl)arguments.get(ARG_NAME)).value();
    if (className.length() == 0) {
        throw new IllegalConnectorArgumentsException("class name missing", ARG_NAME);
    }

    /*
     * Listen on an emperical port; launch the debuggee; wait for
     * for the debuggee to connect; stop listening;
     */
    TransportService.ListenKey key = ts.startListening();

    String exe = System.getProperty("java.home") + File.separator + "bin" +
        File.separator + "java";
    String cmd = exe + " -Xdebug -Xrunjdwp:transport=dt_socket,timeout=15000,address=" +
        key.address() +
        " -classpath " + System.getProperty("test.classes") +
        " " + className;
    Process process = Runtime.getRuntime().exec(cmd);
    Connection conn = ts.accept(key, 30*1000, 9*1000);
    ts.stopListening(key);

    /*
     * Debugee is connected - return the virtual machine mirror
     */
    return Bootstrap.virtualMachineManager().createVirtualMachine(conn);
}
 
Example #7
Source File: SimpleLaunchingConnector.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
public SimpleLaunchingConnector() {
    try {
        Class c = Class.forName("com.sun.tools.jdi.SocketTransportService");
        ts = (TransportService)c.newInstance();
    } catch (Exception x) {
        throw new Error(x);
    }
}
 
Example #8
Source File: SocketListeningConnector.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void updateArgumentMapIfRequired(
    Map<String, ? extends Connector.Argument> args, TransportService.ListenKey listener) {
    if (isWildcardPort(args)) {
        String[] address = listener.address().split(":");
        if (address.length > 1) {
            args.get(ARG_PORT).setValue(address[1]);
        }
    }
}
 
Example #9
Source File: SimpleLaunchingConnector.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public VirtualMachine launch(Map<String, ? extends Connector.Argument> arguments) throws
                          IOException,
                          IllegalConnectorArgumentsException,
                          VMStartException {

    /*
     * Get the class name that we are to execute
     */
    String className = ((StringArgumentImpl)arguments.get(ARG_NAME)).value();
    if (className.length() == 0) {
        throw new IllegalConnectorArgumentsException("class name missing", ARG_NAME);
    }

    /*
     * Listen on an emperical port; launch the debuggee; wait for
     * for the debuggee to connect; stop listening;
     */
    TransportService.ListenKey key = ts.startListening();

    String exe = System.getProperty("java.home") + File.separator + "bin" +
        File.separator + "java";
    String cmd = exe + " -Xdebug -Xrunjdwp:transport=dt_socket,timeout=15000,address=" +
        key.address() +
        " -classpath " + System.getProperty("test.classes") +
        " " + className;
    Process process = Runtime.getRuntime().exec(cmd);
    Connection conn = ts.accept(key, 30*1000, 9*1000);
    ts.stopListening(key);

    /*
     * Debugee is connected - return the virtual machine mirror
     */
    return Bootstrap.virtualMachineManager().createVirtualMachine(conn);
}
 
Example #10
Source File: SimpleLaunchingConnector.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public SimpleLaunchingConnector() {
    try {
        Class c = Class.forName("com.sun.tools.jdi.SocketTransportService");
        ts = (TransportService)c.newInstance();
    } catch (Exception x) {
        throw new Error(x);
    }
}
 
Example #11
Source File: SimpleLaunchingConnector.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public VirtualMachine launch(Map<String, ? extends Connector.Argument> arguments) throws
                          IOException,
                          IllegalConnectorArgumentsException,
                          VMStartException {

    /*
     * Get the class name that we are to execute
     */
    String className = ((StringArgumentImpl)arguments.get(ARG_NAME)).value();
    if (className.length() == 0) {
        throw new IllegalConnectorArgumentsException("class name missing", ARG_NAME);
    }

    /*
     * Listen on an emperical port; launch the debuggee; wait for
     * for the debuggee to connect; stop listening;
     */
    TransportService.ListenKey key = ts.startListening();

    String exe = System.getProperty("java.home") + File.separator + "bin" +
        File.separator + "java";
    String cmd = exe + " -Xdebug -Xrunjdwp:transport=dt_socket,timeout=15000,address=" +
        key.address() +
        " -classpath " + System.getProperty("test.classes") +
        " " + className;
    Process process = Runtime.getRuntime().exec(cmd);
    Connection conn = ts.accept(key, 30*1000, 9*1000);
    ts.stopListening(key);

    /*
     * Debugee is connected - return the virtual machine mirror
     */
    return Bootstrap.virtualMachineManager().createVirtualMachine(conn);
}
 
Example #12
Source File: SimpleLaunchingConnector.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public SimpleLaunchingConnector() {
    try {
        Class c = Class.forName("com.sun.tools.jdi.SocketTransportService");
        ts = (TransportService)c.newInstance();
    } catch (Exception x) {
        throw new Error(x);
    }
}
 
Example #13
Source File: SimpleLaunchingConnector.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public VirtualMachine launch(Map<String, ? extends Connector.Argument> arguments) throws
                          IOException,
                          IllegalConnectorArgumentsException,
                          VMStartException {

    /*
     * Get the class name that we are to execute
     */
    String className = ((StringArgumentImpl)arguments.get(ARG_NAME)).value();
    if (className.length() == 0) {
        throw new IllegalConnectorArgumentsException("class name missing", ARG_NAME);
    }

    /*
     * Listen on an emperical port; launch the debuggee; wait for
     * for the debuggee to connect; stop listening;
     */
    TransportService.ListenKey key = ts.startListening();

    String exe = System.getProperty("java.home") + File.separator + "bin" +
        File.separator + "java";
    String cmd = exe + " -Xdebug -Xrunjdwp:transport=dt_socket,timeout=15000,address=" +
        key.address() +
        " -classpath " + System.getProperty("test.classes") +
        " " + className;
    Process process = Runtime.getRuntime().exec(cmd);
    Connection conn = ts.accept(key, 30*1000, 9*1000);
    ts.stopListening(key);

    /*
     * Debugee is connected - return the virtual machine mirror
     */
    return Bootstrap.virtualMachineManager().createVirtualMachine(conn);
}
 
Example #14
Source File: SimpleLaunchingConnector.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public SimpleLaunchingConnector() {
    try {
        Class c = Class.forName("com.sun.tools.jdi.SocketTransportService");
        ts = (TransportService)c.newInstance();
    } catch (Exception x) {
        throw new Error(x);
    }
}
 
Example #15
Source File: SimpleLaunchingConnector.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
public VirtualMachine launch(Map<String, ? extends Connector.Argument> arguments) throws
                          IOException,
                          IllegalConnectorArgumentsException,
                          VMStartException {

    /*
     * Get the class name that we are to execute
     */
    String className = ((StringArgumentImpl)arguments.get(ARG_NAME)).value();
    if (className.length() == 0) {
        throw new IllegalConnectorArgumentsException("class name missing", ARG_NAME);
    }

    /*
     * Listen on an emperical port; launch the debuggee; wait for
     * for the debuggee to connect; stop listening;
     */
    TransportService.ListenKey key = ts.startListening();

    String exe = System.getProperty("java.home") + File.separator + "bin" +
        File.separator + "java";
    String cmd = exe + " -Xdebug -Xrunjdwp:transport=dt_socket,timeout=15000,address=" +
        key.address() +
        " -classpath " + System.getProperty("test.classes") +
        " " + className;
    Process process = Runtime.getRuntime().exec(cmd);
    Connection conn = ts.accept(key, 30*1000, 9*1000);
    ts.stopListening(key);

    /*
     * Debugee is connected - return the virtual machine mirror
     */
    return Bootstrap.virtualMachineManager().createVirtualMachine(conn);
}
 
Example #16
Source File: SocketListeningConnector.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void updateArgumentMapIfRequired(
    Map<String, ? extends Connector.Argument> args, TransportService.ListenKey listener) {
    if (isWildcardPort(args)) {
        String[] address = listener.address().split(":");
        if (address.length > 1) {
            args.get(ARG_PORT).setValue(address[1]);
        }
    }
}
 
Example #17
Source File: SimpleLaunchingConnector.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public VirtualMachine launch(Map<String, ? extends Connector.Argument> arguments) throws
                          IOException,
                          IllegalConnectorArgumentsException,
                          VMStartException {

    /*
     * Get the class name that we are to execute
     */
    String className = ((StringArgumentImpl)arguments.get(ARG_NAME)).value();
    if (className.length() == 0) {
        throw new IllegalConnectorArgumentsException("class name missing", ARG_NAME);
    }

    /*
     * Listen on an emperical port; launch the debuggee; wait for
     * for the debuggee to connect; stop listening;
     */
    TransportService.ListenKey key = ts.startListening();

    String exe = System.getProperty("java.home") + File.separator + "bin" +
        File.separator + "java";
    String cmd = exe + " -Xdebug -Xrunjdwp:transport=dt_socket,timeout=15000,address=" +
        key.address() +
        " -classpath " + System.getProperty("test.classes") +
        " " + className;
    Process process = Runtime.getRuntime().exec(cmd);
    Connection conn = ts.accept(key, 30*1000, 9*1000);
    ts.stopListening(key);

    /*
     * Debugee is connected - return the virtual machine mirror
     */
    return Bootstrap.virtualMachineManager().createVirtualMachine(conn);
}
 
Example #18
Source File: SimpleLaunchingConnector.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public SimpleLaunchingConnector() {
    try {
        Class<?> c = Class.forName("com.sun.tools.jdi.SocketTransportService");
        ts = (TransportService)c.newInstance();
    } catch (Exception x) {
        throw new Error(x);
    }
}
 
Example #19
Source File: SimpleLaunchingConnector.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public VirtualMachine launch(Map<String, ? extends Connector.Argument> arguments) throws
                          IOException,
                          IllegalConnectorArgumentsException,
                          VMStartException {

    /*
     * Get the class name that we are to execute
     */
    String className = ((StringArgumentImpl)arguments.get(ARG_NAME)).value();
    if (className.length() == 0) {
        throw new IllegalConnectorArgumentsException("class name missing", ARG_NAME);
    }

    /*
     * Listen on an emperical port; launch the debuggee; wait for
     * for the debuggee to connect; stop listening;
     */
    TransportService.ListenKey key = ts.startListening();

    String exe = System.getProperty("java.home") + File.separator + "bin" +
        File.separator + "java";
    String cmd = exe + " -Xdebug -Xrunjdwp:transport=dt_socket,timeout=15000,address=" +
        key.address() +
        " -classpath " + System.getProperty("test.classes") +
        " " + className;
    Process process = Runtime.getRuntime().exec(cmd);
    Connection conn = ts.accept(key, 30*1000, 9*1000);
    ts.stopListening(key);

    /*
     * Debugee is connected - return the virtual machine mirror
     */
    return Bootstrap.virtualMachineManager().createVirtualMachine(conn);
}
 
Example #20
Source File: SimpleLaunchingConnector.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public SimpleLaunchingConnector() {
    try {
        Class c = Class.forName("com.sun.tools.jdi.SocketTransportService");
        ts = (TransportService)c.newInstance();
    } catch (Exception x) {
        throw new Error(x);
    }
}
 
Example #21
Source File: SimpleLaunchingConnector.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public VirtualMachine launch(Map<String, ? extends Connector.Argument> arguments) throws
                          IOException,
                          IllegalConnectorArgumentsException,
                          VMStartException {

    /*
     * Get the class name that we are to execute
     */
    String className = ((StringArgumentImpl)arguments.get(ARG_NAME)).value();
    if (className.length() == 0) {
        throw new IllegalConnectorArgumentsException("class name missing", ARG_NAME);
    }

    /*
     * Listen on an emperical port; launch the debuggee; wait for
     * for the debuggee to connect; stop listening;
     */
    TransportService.ListenKey key = ts.startListening();

    String exe = System.getProperty("java.home") + File.separator + "bin" +
        File.separator + "java";
    String cmd = exe + " -Xdebug -Xrunjdwp:transport=dt_socket,timeout=15000,address=" +
        key.address() +
        " -classpath " + System.getProperty("test.classes") +
        " " + className;
    Process process = Runtime.getRuntime().exec(cmd);
    Connection conn = ts.accept(key, 30*1000, 9*1000);
    ts.stopListening(key);

    /*
     * Debugee is connected - return the virtual machine mirror
     */
    return Bootstrap.virtualMachineManager().createVirtualMachine(conn);
}
 
Example #22
Source File: SimpleLaunchingConnector.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public SimpleLaunchingConnector() {
    try {
        Class c = Class.forName("com.sun.tools.jdi.SocketTransportService");
        ts = (TransportService)c.newInstance();
    } catch (Exception x) {
        throw new Error(x);
    }
}
 
Example #23
Source File: SocketListeningConnector.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void updateArgumentMapIfRequired(
    Map<String, ? extends Connector.Argument> args, TransportService.ListenKey listener) {
    if (isWildcardPort(args)) {
        String[] address = listener.address().split(":");
        if (address.length > 1) {
            args.get(ARG_PORT).setValue(address[1]);
        }
    }
}
 
Example #24
Source File: SimpleLaunchingConnector.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public VirtualMachine launch(Map<String, ? extends Connector.Argument> arguments) throws
                          IOException,
                          IllegalConnectorArgumentsException,
                          VMStartException {

    /*
     * Get the class name that we are to execute
     */
    String className = ((StringArgumentImpl)arguments.get(ARG_NAME)).value();
    if (className.length() == 0) {
        throw new IllegalConnectorArgumentsException("class name missing", ARG_NAME);
    }

    /*
     * Listen on an emperical port; launch the debuggee; wait for
     * for the debuggee to connect; stop listening;
     */
    TransportService.ListenKey key = ts.startListening();

    String exe = System.getProperty("java.home") + File.separator + "bin" +
        File.separator + "java";
    String cmd = exe + " -Xdebug -Xrunjdwp:transport=dt_socket,timeout=15000,address=" +
        key.address() +
        " -classpath " + System.getProperty("test.classes") +
        " " + className;
    Process process = Runtime.getRuntime().exec(cmd);
    Connection conn = ts.accept(key, 30*1000, 9*1000);
    ts.stopListening(key);

    /*
     * Debugee is connected - return the virtual machine mirror
     */
    return Bootstrap.virtualMachineManager().createVirtualMachine(conn);
}
 
Example #25
Source File: SimpleLaunchingConnector.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public SimpleLaunchingConnector() {
    try {
        Class c = Class.forName("com.sun.tools.jdi.SocketTransportService");
        ts = (TransportService)c.newInstance();
    } catch (Exception x) {
        throw new Error(x);
    }
}
 
Example #26
Source File: SimpleLaunchingConnector.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public VirtualMachine launch(Map<String, ? extends Connector.Argument> arguments) throws
                          IOException,
                          IllegalConnectorArgumentsException,
                          VMStartException {

    /*
     * Get the class name that we are to execute
     */
    String className = ((StringArgumentImpl)arguments.get(ARG_NAME)).value();
    if (className.length() == 0) {
        throw new IllegalConnectorArgumentsException("class name missing", ARG_NAME);
    }

    /*
     * Listen on an emperical port; launch the debuggee; wait for
     * for the debuggee to connect; stop listening;
     */
    TransportService.ListenKey key = ts.startListening();

    String exe = System.getProperty("java.home") + File.separator + "bin" +
        File.separator + "java";
    String cmd = exe + " -Xdebug -Xrunjdwp:transport=dt_socket,timeout=15000,address=" +
        key.address() +
        " -classpath " + System.getProperty("test.classes") +
        " " + className;
    Process process = Runtime.getRuntime().exec(cmd);
    Connection conn = ts.accept(key, 30*1000, 9*1000);
    ts.stopListening(key);

    /*
     * Debugee is connected - return the virtual machine mirror
     */
    return Bootstrap.virtualMachineManager().createVirtualMachine(conn);
}
 
Example #27
Source File: SimpleLaunchingConnector.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public SimpleLaunchingConnector() {
    try {
        Class c = Class.forName("com.sun.tools.jdi.SocketTransportService");
        ts = (TransportService)c.newInstance();
    } catch (Exception x) {
        throw new Error(x);
    }
}
 
Example #28
Source File: SocketListeningConnector.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected void updateArgumentMapIfRequired(
    Map<String, ? extends Connector.Argument> args, TransportService.ListenKey listener) {
    if (isWildcardPort(args)) {
        String[] address = listener.address().split(":");
        if (address.length > 1) {
            args.get(ARG_PORT).setValue(address[1]);
        }
    }
}
 
Example #29
Source File: SimpleLaunchingConnector.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public VirtualMachine launch(Map<String, ? extends Connector.Argument> arguments) throws
                          IOException,
                          IllegalConnectorArgumentsException,
                          VMStartException {

    /*
     * Get the class name that we are to execute
     */
    String className = ((StringArgumentImpl)arguments.get(ARG_NAME)).value();
    if (className.length() == 0) {
        throw new IllegalConnectorArgumentsException("class name missing", ARG_NAME);
    }

    /*
     * Listen on an emperical port; launch the debuggee; wait for
     * for the debuggee to connect; stop listening;
     */
    TransportService.ListenKey key = ts.startListening();

    String exe = System.getProperty("java.home") + File.separator + "bin" +
        File.separator + "java";
    String cmd = exe + " -Xdebug -Xrunjdwp:transport=dt_socket,timeout=15000,address=" +
        key.address() +
        " -classpath " + System.getProperty("test.classes") +
        " " + className;
    Process process = Runtime.getRuntime().exec(cmd);
    Connection conn = ts.accept(key, 30*1000, 9*1000);
    ts.stopListening(key);

    /*
     * Debugee is connected - return the virtual machine mirror
     */
    return Bootstrap.virtualMachineManager().createVirtualMachine(conn);
}
 
Example #30
Source File: SimpleLaunchingConnector.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
public SimpleLaunchingConnector() {
    try {
        Class c = Class.forName("com.sun.tools.jdi.SocketTransportService");
        ts = (TransportService)c.newInstance();
    } catch (Exception x) {
        throw new Error(x);
    }
}