if (localJar.lastModified() != jarTimestamp) {
try {
seleniumJar.copyTo(new FilePath(localJar));
localJar.setLastModified(jarTimestamp);
} catch (InterruptedException e) {
throw new IOException2("Failed to copy grid jar", e);
}
}
try {
// listener.getLogger().println("Creating selenium VM");
Channel jvm = SeleniumProcessUtils.createSeleniumRCVM(localJar, listener, options.getJVMArguments(), options.getEnvironmentVariables());
status = new RemoteRunningStatus(jvm, options);
status.setStatus(SeleniumConstants.STARTING);
List<String> arguments = new ArrayList<String>(options.getSeleniumArguments().size());
for (ProcessArgument arg : options.getSeleniumArguments()) {
arguments.addAll(arg.toArgumentsList());
}
// listener.getLogger().println("Starting the selenium process");
jvm.callAsync(new RemoteControlLauncher(nodeName, (String[]) ArrayUtils.addAll(defaultArgs, arguments.toArray(new String[0]))));
status.setStatus(SeleniumConstants.STARTED);
status.setRunning(true);
} catch (Exception t) {
status.setRunning(false);
status.setStatus(SeleniumConstants.ERROR);
LOGGER.log(Level.WARNING, "Selenium launch failed", t);
// listener.getLogger().println( "Selenium launch failed" + t.getMessage());
throw new IOException2("Selenium launch interrupted", t);
}
PropertyUtils.setMapProperty(SeleniumConstants.PROPERTY_STATUS, config, status);
return config;
}