com.sun.jdi.connect.Connector Java Examples
The following examples show how to use
com.sun.jdi.connect.Connector.
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: AcceptTimeout.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
public static void main(String args[]) throws Exception { List<ListeningConnector> connectors = Bootstrap.virtualMachineManager().listeningConnectors(); for (ListeningConnector lc: connectors) { Map<String,Connector.Argument> cargs = lc.defaultArguments(); Connector.IntegerArgument timeout = (Connector.IntegerArgument)cargs.get("timeout"); /* * If the Connector has a argument named "timeout" then we set the timeout to 1 second * and start it listening on its default address. It should throw TranpsortTimeoutException. */ if (timeout != null) { System.out.println("Testing " + lc.name()); timeout.setValue(1000); System.out.println("Listening on: " + lc.startListening(cargs)); try { lc.accept(cargs); throw new RuntimeException("Connection accepted from some debuggee - unexpected!"); } catch (TransportTimeoutException e) { System.out.println("Timed out as expected.\n"); } lc.stopListening(cargs); } } }
Example #2
Source File: FieldMonitor.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
/** * Return the launching connector's arguments. */ static Map <String,Connector.Argument> connectorArguments(LaunchingConnector connector, String mainArgs) { Map<String,Connector.Argument> arguments = connector.defaultArguments(); for (String key : arguments.keySet()) { System.out.println(key); } Connector.Argument mainArg = (Connector.Argument)arguments.get("main"); if (mainArg == null) { throw new Error("Bad launching connector"); } mainArg.setValue(mainArgs); Connector.Argument optionsArg = (Connector.Argument)arguments.get("options"); if (optionsArg == null) { throw new Error("Bad launching connector"); } optionsArg.setValue(ARGUMENTS); return arguments; }
Example #3
Source File: AcceptTimeout.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
public static void main(String args[]) throws Exception { List<ListeningConnector> connectors = Bootstrap.virtualMachineManager().listeningConnectors(); for (ListeningConnector lc: connectors) { Map<String,Connector.Argument> cargs = lc.defaultArguments(); Connector.IntegerArgument timeout = (Connector.IntegerArgument)cargs.get("timeout"); /* * If the Connector has a argument named "timeout" then we set the timeout to 1 second * and start it listening on its default address. It should throw TranpsortTimeoutException. */ if (timeout != null) { System.out.println("Testing " + lc.name()); timeout.setValue(1000); System.out.println("Listening on: " + lc.startListening(cargs)); try { lc.accept(cargs); throw new RuntimeException("Connection accepted from some debuggee - unexpected!"); } catch (TransportTimeoutException e) { System.out.println("Timed out as expected.\n"); } lc.stopListening(cargs); } } }
Example #4
Source File: AcceptTimeout.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public static void main(String args[]) throws Exception { List<ListeningConnector> connectors = Bootstrap.virtualMachineManager().listeningConnectors(); for (ListeningConnector lc: connectors) { Map<String,Connector.Argument> cargs = lc.defaultArguments(); Connector.IntegerArgument timeout = (Connector.IntegerArgument)cargs.get("timeout"); /* * If the Connector has a argument named "timeout" then we set the timeout to 1 second * and start it listening on its default address. It should throw TranpsortTimeoutException. */ if (timeout != null) { System.out.println("Testing " + lc.name()); timeout.setValue(1000); System.out.println("Listening on: " + lc.startListening(cargs)); try { lc.accept(cargs); throw new RuntimeException("Connection accepted from some debuggee - unexpected!"); } catch (TransportTimeoutException e) { System.out.println("Timed out as expected.\n"); } lc.stopListening(cargs); } } }
Example #5
Source File: AcceptTimeout.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
public static void main(String args[]) throws Exception { List<ListeningConnector> connectors = Bootstrap.virtualMachineManager().listeningConnectors(); for (ListeningConnector lc: connectors) { Map<String,Connector.Argument> cargs = lc.defaultArguments(); Connector.IntegerArgument timeout = (Connector.IntegerArgument)cargs.get("timeout"); /* * If the Connector has a argument named "timeout" then we set the timeout to 1 second * and start it listening on its default address. It should throw TranpsortTimeoutException. */ if (timeout != null) { System.out.println("Testing " + lc.name()); timeout.setValue(1000); System.out.println("Listening on: " + lc.startListening(cargs)); try { lc.accept(cargs); throw new RuntimeException("Connection accepted from some debuggee - unexpected!"); } catch (TransportTimeoutException e) { System.out.println("Timed out as expected.\n"); } lc.stopListening(cargs); } } }
Example #6
Source File: FieldMonitor.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * Return the launching connector's arguments. */ static Map <String,Connector.Argument> connectorArguments(LaunchingConnector connector, String mainArgs) { Map<String,Connector.Argument> arguments = connector.defaultArguments(); for (String key : arguments.keySet()) { System.out.println(key); } Connector.Argument mainArg = (Connector.Argument)arguments.get("main"); if (mainArg == null) { throw new Error("Bad launching connector"); } mainArg.setValue(mainArgs); Connector.Argument optionsArg = (Connector.Argument)arguments.get("options"); if (optionsArg == null) { throw new Error("Bad launching connector"); } optionsArg.setValue(ARGUMENTS); return arguments; }
Example #7
Source File: AcceptTimeout.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
public static void main(String args[]) throws Exception { List<ListeningConnector> connectors = Bootstrap.virtualMachineManager().listeningConnectors(); for (ListeningConnector lc: connectors) { Map<String,Connector.Argument> cargs = lc.defaultArguments(); Connector.IntegerArgument timeout = (Connector.IntegerArgument)cargs.get("timeout"); /* * If the Connector has a argument named "timeout" then we set the timeout to 1 second * and start it listening on its default address. It should throw TranpsortTimeoutException. */ if (timeout != null) { System.out.println("Testing " + lc.name()); timeout.setValue(1000); System.out.println("Listening on: " + lc.startListening(cargs)); try { lc.accept(cargs); throw new RuntimeException("Connection accepted from some debuggee - unexpected!"); } catch (TransportTimeoutException e) { System.out.println("Timed out as expected.\n"); } lc.stopListening(cargs); } } }
Example #8
Source File: ChildSession.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
static private VirtualMachine generalGetVM(OutputListener diagnostics, LaunchingConnector connector, Map<String, Connector.Argument> arguments) { VirtualMachine vm = null; try { diagnostics.putString("Starting child."); vm = connector.launch(arguments); } catch (IOException ioe) { diagnostics.putString("Unable to start child: " + ioe.getMessage()); } catch (IllegalConnectorArgumentsException icae) { diagnostics.putString("Unable to start child: " + icae.getMessage()); } catch (VMStartException vmse) { diagnostics.putString("Unable to start child: " + vmse.getMessage() + '\n'); dumpFailedLaunchInfo(diagnostics, vmse.process()); } return vm; }
Example #9
Source File: ChildSession.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
static private VirtualMachine generalGetVM(OutputListener diagnostics, LaunchingConnector connector, Map<String, Connector.Argument> arguments) { VirtualMachine vm = null; try { diagnostics.putString("Starting child."); vm = connector.launch(arguments); } catch (IOException ioe) { diagnostics.putString("Unable to start child: " + ioe.getMessage()); } catch (IllegalConnectorArgumentsException icae) { diagnostics.putString("Unable to start child: " + icae.getMessage()); } catch (VMStartException vmse) { diagnostics.putString("Unable to start child: " + vmse.getMessage() + '\n'); dumpFailedLaunchInfo(diagnostics, vmse.process()); } return vm; }
Example #10
Source File: ChildSession.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
static private VirtualMachine generalGetVM(OutputListener diagnostics, LaunchingConnector connector, Map<String, Connector.Argument> arguments) { VirtualMachine vm = null; try { diagnostics.putString("Starting child."); vm = connector.launch(arguments); } catch (IOException ioe) { diagnostics.putString("Unable to start child: " + ioe.getMessage()); } catch (IllegalConnectorArgumentsException icae) { diagnostics.putString("Unable to start child: " + icae.getMessage()); } catch (VMStartException vmse) { diagnostics.putString("Unable to start child: " + vmse.getMessage() + '\n'); dumpFailedLaunchInfo(diagnostics, vmse.process()); } return vm; }
Example #11
Source File: FieldMonitor.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * Return the launching connector's arguments. */ static Map <String,Connector.Argument> connectorArguments(LaunchingConnector connector, String mainArgs) { Map<String,Connector.Argument> arguments = connector.defaultArguments(); for (String key : arguments.keySet()) { System.out.println(key); } Connector.Argument mainArg = (Connector.Argument)arguments.get("main"); if (mainArg == null) { throw new Error("Bad launching connector"); } mainArg.setValue(mainArgs); Connector.Argument optionsArg = (Connector.Argument)arguments.get("options"); if (optionsArg == null) { throw new Error("Bad launching connector"); } optionsArg.setValue(ARGUMENTS); return arguments; }
Example #12
Source File: AcceptTimeout.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
public static void main(String args[]) throws Exception { List<ListeningConnector> connectors = Bootstrap.virtualMachineManager().listeningConnectors(); for (ListeningConnector lc: connectors) { Map<String,Connector.Argument> cargs = lc.defaultArguments(); Connector.IntegerArgument timeout = (Connector.IntegerArgument)cargs.get("timeout"); /* * If the Connector has a argument named "timeout" then we set the timeout to 1 second * and start it listening on its default address. It should throw TranpsortTimeoutException. */ if (timeout != null) { System.out.println("Testing " + lc.name()); timeout.setValue(1000); System.out.println("Listening on: " + lc.startListening(cargs)); try { lc.accept(cargs); throw new RuntimeException("Connection accepted from some debuggee - unexpected!"); } catch (TransportTimeoutException e) { System.out.println("Timed out as expected.\n"); } lc.stopListening(cargs); } } }
Example #13
Source File: HotSwapper.java From HotswapAgent with GNU General Public License v2.0 | 6 votes |
/** * Connects to the JVM. * * @param port the port number used for the connection to the JVM. */ public HotSwapper(String port) throws IOException, IllegalConnectorArgumentsException { jvm = null; request = null; newClassFiles = null; trigger = new Trigger(); AttachingConnector connector = (AttachingConnector)findConnector("com.sun.jdi.SocketAttach"); Map<String,Connector.Argument> arguments = connector.defaultArguments(); arguments.get("hostname").setValue(HOST_NAME); arguments.get("port").setValue(port); jvm = connector.attach(arguments); EventRequestManager manager = jvm.eventRequestManager(); request = methodEntryRequests(manager, TRIGGER_NAME); }
Example #14
Source File: ChildSession.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
static private VirtualMachine generalGetVM(OutputListener diagnostics, LaunchingConnector connector, Map<String, Connector.Argument> arguments) { VirtualMachine vm = null; try { diagnostics.putString("Starting child."); vm = connector.launch(arguments); } catch (IOException ioe) { diagnostics.putString("Unable to start child: " + ioe.getMessage()); } catch (IllegalConnectorArgumentsException icae) { diagnostics.putString("Unable to start child: " + icae.getMessage()); } catch (VMStartException vmse) { diagnostics.putString("Unable to start child: " + vmse.getMessage() + '\n'); dumpFailedLaunchInfo(diagnostics, vmse.process()); } return vm; }
Example #15
Source File: AcceptTimeout.java From hottub with GNU General Public License v2.0 | 6 votes |
public static void main(String args[]) throws Exception { List<ListeningConnector> connectors = Bootstrap.virtualMachineManager().listeningConnectors(); for (ListeningConnector lc: connectors) { Map<String,Connector.Argument> cargs = lc.defaultArguments(); Connector.IntegerArgument timeout = (Connector.IntegerArgument)cargs.get("timeout"); /* * If the Connector has a argument named "timeout" then we set the timeout to 1 second * and start it listening on its default address. It should throw TranpsortTimeoutException. */ if (timeout != null) { System.out.println("Testing " + lc.name()); timeout.setValue(1000); System.out.println("Listening on: " + lc.startListening(cargs)); try { lc.accept(cargs); throw new RuntimeException("Connection accepted from some debuggee - unexpected!"); } catch (TransportTimeoutException e) { System.out.println("Timed out as expected.\n"); } lc.stopListening(cargs); } } }
Example #16
Source File: JdiInitiator.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
private Map<String, Connector.Argument> mergeConnectorArgs(Connector connector, Map<String, String> argumentName2Value) { Map<String, Connector.Argument> arguments = connector.defaultArguments(); for (Entry<String, String> argumentEntry : argumentName2Value.entrySet()) { String name = argumentEntry.getKey(); String value = argumentEntry.getValue(); Connector.Argument argument = arguments.get(name); if (argument == null) { throw new IllegalArgumentException("Argument is not defined for connector:" + name + " -- " + connector.name()); } argument.setValue(value); } return arguments; }
Example #17
Source File: FieldMonitor.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * Return the launching connector's arguments. */ static Map <String,Connector.Argument> connectorArguments(LaunchingConnector connector, String mainArgs) { Map<String,Connector.Argument> arguments = connector.defaultArguments(); for (String key : arguments.keySet()) { System.out.println(key); } Connector.Argument mainArg = (Connector.Argument)arguments.get("main"); if (mainArg == null) { throw new Error("Bad launching connector"); } mainArg.setValue(mainArgs); Connector.Argument optionsArg = (Connector.Argument)arguments.get("options"); if (optionsArg == null) { throw new Error("Bad launching connector"); } optionsArg.setValue(ARGUMENTS); return arguments; }
Example #18
Source File: ChildSession.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
static private VirtualMachine generalGetVM(OutputListener diagnostics, LaunchingConnector connector, Map<String, Connector.Argument> arguments) { VirtualMachine vm = null; try { diagnostics.putString("Starting child."); vm = connector.launch(arguments); } catch (IOException ioe) { diagnostics.putString("Unable to start child: " + ioe.getMessage()); } catch (IllegalConnectorArgumentsException icae) { diagnostics.putString("Unable to start child: " + icae.getMessage()); } catch (VMStartException vmse) { diagnostics.putString("Unable to start child: " + vmse.getMessage() + '\n'); dumpFailedLaunchInfo(diagnostics, vmse.process()); } return vm; }
Example #19
Source File: AcceptTimeout.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public static void main(String args[]) throws Exception { List<ListeningConnector> connectors = Bootstrap.virtualMachineManager().listeningConnectors(); for (ListeningConnector lc: connectors) { Map<String,Connector.Argument> cargs = lc.defaultArguments(); Connector.IntegerArgument timeout = (Connector.IntegerArgument)cargs.get("timeout"); /* * If the Connector has a argument named "timeout" then we set the timeout to 1 second * and start it listening on its default address. It should throw TranpsortTimeoutException. */ if (timeout != null) { System.out.println("Testing " + lc.name()); timeout.setValue(1000); System.out.println("Listening on: " + lc.startListening(cargs)); try { lc.accept(cargs); throw new RuntimeException("Connection accepted from some debuggee - unexpected!"); } catch (TransportTimeoutException e) { System.out.println("Timed out as expected.\n"); } lc.stopListening(cargs); } } }
Example #20
Source File: FieldMonitor.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Return the launching connector's arguments. */ static Map <String,Connector.Argument> connectorArguments(LaunchingConnector connector, String mainArgs) { Map<String,Connector.Argument> arguments = connector.defaultArguments(); for (String key : arguments.keySet()) { System.out.println(key); } Connector.Argument mainArg = (Connector.Argument)arguments.get("main"); if (mainArg == null) { throw new Error("Bad launching connector"); } mainArg.setValue(mainArgs); Connector.Argument optionsArg = (Connector.Argument)arguments.get("options"); if (optionsArg == null) { throw new Error("Bad launching connector"); } optionsArg.setValue(ARGUMENTS); return arguments; }
Example #21
Source File: ChildSession.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
static private VirtualMachine generalGetVM(OutputListener diagnostics, LaunchingConnector connector, Map<String, Connector.Argument> arguments) { VirtualMachine vm = null; try { diagnostics.putString("Starting child."); vm = connector.launch(arguments); } catch (IOException ioe) { diagnostics.putString("Unable to start child: " + ioe.getMessage()); } catch (IllegalConnectorArgumentsException icae) { diagnostics.putString("Unable to start child: " + icae.getMessage()); } catch (VMStartException vmse) { diagnostics.putString("Unable to start child: " + vmse.getMessage() + '\n'); dumpFailedLaunchInfo(diagnostics, vmse.process()); } return vm; }
Example #22
Source File: HotSwapperJpda.java From HotswapAgent with GNU General Public License v2.0 | 5 votes |
private Connector findConnector(String connector) throws IOException { List<Connector> connectors = Bootstrap.virtualMachineManager().allConnectors(); for (Connector con:connectors) if (con.name().equals(connector)) return con; throw new IOException("Not found: " + connector); }
Example #23
Source File: BadHandshakeTest.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
private static Connector findConnector(String name) { List connectors = Bootstrap.virtualMachineManager().allConnectors(); Iterator iter = connectors.iterator(); while (iter.hasNext()) { Connector connector = (Connector)iter.next(); if (connector.name().equals(name)) { return connector; } } return null; }
Example #24
Source File: SimpleLaunchingConnector.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
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: FieldMonitor.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Find a com.sun.jdi.CommandLineLaunch connector */ static LaunchingConnector findLaunchingConnector() { List <Connector> connectors = Bootstrap.virtualMachineManager().allConnectors(); Iterator <Connector> iter = connectors.iterator(); while (iter.hasNext()) { Connector connector = iter.next(); if (connector.name().equals("com.sun.jdi.CommandLineLaunch")) { return (LaunchingConnector)connector; } } throw new Error("No launching connector"); }
Example #26
Source File: BadHandshakeTest.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private static Connector findConnector(String name) { List connectors = Bootstrap.virtualMachineManager().allConnectors(); Iterator iter = connectors.iterator(); while (iter.hasNext()) { Connector connector = (Connector)iter.next(); if (connector.name().equals(name)) { return connector; } } return null; }
Example #27
Source File: VMAcquirer.java From nopol with GNU General Public License v2.0 | 5 votes |
private AttachingConnector getConnector() { VirtualMachineManager vmManager = Bootstrap.virtualMachineManager(); for (Connector connector : vmManager.attachingConnectors()) { if ("com.sun.jdi.SocketAttach".equals(connector.name())) { return (AttachingConnector) connector; } } throw new IllegalStateException(); }
Example #28
Source File: ChildSession.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
static private VirtualMachine getVM(OutputListener diagnostics, String userVMArgs, String cmdLine) { VirtualMachineManager manager = Bootstrap.virtualMachineManager(); LaunchingConnector connector = manager.defaultConnector(); Map<String, Connector.Argument> arguments = connector.defaultArguments(); arguments.get("options").setValue(userVMArgs); arguments.get("main").setValue(cmdLine); return generalGetVM(diagnostics, connector, arguments); }
Example #29
Source File: RunToExit.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private static Connector findConnector(String name) { List connectors = Bootstrap.virtualMachineManager().allConnectors(); Iterator iter = connectors.iterator(); while (iter.hasNext()) { Connector connector = (Connector)iter.next(); if (connector.name().equals(name)) { return connector; } } return null; }
Example #30
Source File: ChildSession.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
static private VirtualMachine getVM(OutputListener diagnostics, String userVMArgs, String cmdLine) { VirtualMachineManager manager = Bootstrap.virtualMachineManager(); LaunchingConnector connector = manager.defaultConnector(); Map<String, Connector.Argument> arguments = connector.defaultArguments(); arguments.get("options").setValue(userVMArgs); arguments.get("main").setValue(cmdLine); return generalGetVM(diagnostics, connector, arguments); }