public
VirtualMachine launch(Map<String, ?
extends
Connector.Argument> connectionArgs)
throws
IOException, IllegalConnectorArgumentsException, VMStartException
{
getConnectionArguments(connectionArgs);
SocketListeningConnectorImpl listenConnector =
new
SocketListeningConnectorImpl(
virtualMachineManager());
Map args = listenConnector.defaultArguments();
((Connector.IntegerArgument)args.get(
"timeout"
)).setValue(
10000
);
String address = listenConnector.startListening(args);
String slash = System.getProperty(
"file.separator"
);
String execString =
this
.fHome + slash +
"bin"
+ slash +
this
.fLauncher;
execString = execString +
" -Xdebug -Xnoagent -Djava.compiler=NONE"
;
execString = execString +
" -Xrunjdwp:transport=dt_socket,address="
+ address +
",server=n,suspend="
+ (
this
.fSuspend ?
"y"
:
"n"
);
if
(
this
.fOptions !=
null
) {
execString = execString +
" "
+
this
.fOptions;
}
execString = execString +
" "
+
this
.fMain;
String[] cmdLine = DebugPlugin.parseArguments(execString);
Process proc = Runtime.getRuntime().exec(cmdLine);
try
{
virtualMachine = (VirtualMachineImpl)listenConnector.accept(args);
}
catch
(InterruptedIOException localInterruptedIOException)
{
VirtualMachineImpl virtualMachine;
proc.destroy();
String message = NLS.bind(ConnectMessages.SocketLaunchingConnectorImpl_VM_did_not_connect_within_given_time___0__ms_1,
new
String[] {
((Connector.IntegerArgument)args
.get(
"timeout"
)).value() });
throw
new
VMStartException(message, proc);
}
VirtualMachineImpl virtualMachine;
virtualMachine.setLaunchedProcess(proc);
return
virtualMachine;
}