* Responsible for configuring, starting and stopping services and tools.
* Creates the actual benchmark object and requests it to execute the run.
*/
@SuppressWarnings("static-access")
public void start() {
ParamRepository par = null;
ServerConfig server;
// Read the benchmark description.
BenchmarkDescription benchDesc = run.getBenchDesc();
long startTime; // benchmark start/end time
long endTime;
// Create benchmark object.
logger.fine("Instantiating benchmark class " +
benchDesc.benchmarkClass);
//bm = newInstance(benchDesc);
bmw = BenchmarkWrapper.getInstance(benchDesc);
if (bmw == null)
return;
startTime = System.currentTimeMillis();
// Update the status of the run
try {
run.updateStatus(Run.STARTED);
} catch (IOException e) {
logger.log(Level.SEVERE, "Failed to update run status.", e);
return;
}
// Read in user parameters
logger.info("START TIME : " + new java.util.Date());
logger.fine("Reading in user parameters");
try {
try {
par = new ParamRepository(run.getParamFile(), true);
} catch (Exception e) {
logger.log(Level.SEVERE, "Failed to open ParamRepository "
+ run.getParamFile() + '.', e);
return; // can't proceed with benchmark
}
// Create the facade for the benchmark to access.
RunFacade.newInstance(run, par);
try {
bmw.validate();
} catch (Throwable t) {
logger.log(Level.SEVERE, "Benchmark validation failed.", t);
return;
}
try {
// Initialize CmdService
logger.fine("Initializing Command Service");
cmds = new CmdService();
cmds.init();
// We need to place a marker into the Benchmark's META-INF
// directory so if it is shared, download won't happen.
FileWriter runIdFile = new FileWriter(Config.BENCHMARK_DIR +
run.getBenchmarkName() + File.separator +
"META-INF" + File.separator + "RunID");
runIdFile.write(run.getRunId());
runIdFile.close();
// Start CmdAgent on all ENABLED hosts using the JAVA HOME
// Specified JVM options will be used by the Agent when it
// starts java processes
if (!cmds.setup(benchDesc.shortName, par)) {
logger.severe("CmdService setup failed. Exiting");
return;
}
} catch (Exception e) {
logger.log(Level.SEVERE, "Start failed.", e);
return;
}
// Extract host metadata and save it.
HostRoles hr = new HostRoles(par);
cmds.setHostRoles(hr);
try {
hr.write(run.getOutDir() + File.separator + "META-INF" +
File.separator + "hosttypes");
} catch (IOException e) {
logger.log(Level.WARNING, "Error writing hosttypes file!", e);
}
// Reading parameters needed for ToolService
String s = par.getParameter("fa:runControl/fa:rampUp");
if (s != null)
s = s.trim();
if (s == null || s.length() == 0) {
logger.severe("Configuration runControl/rampUp not set.");
return;
}
int delay = 0;
try {
delay = Integer.parseInt(s);
} catch (NumberFormatException e) {
logger.log(Level.SEVERE,
"Parameter rampUp is not a number.", e);
return;
}
if (delay < 0) {
logger.severe("Parameter rampUp is negative");
return;
}
int len = -1;
s = par.getParameter("fa:runControl/fa:steadyState");
if (s != null) {
s = s.trim();
len = s.length();
}
if (len > 0) {