try {
String s = Config.CMD_AGENT + "@" + mach;
logger.fine("CmdService: Connecting to " + s);
int retry = 1;
CmdAgent c = (CmdAgent) registry.getService(s);
for (; c == null && retry <= 10; retry++) {
Thread.sleep(10000);
logger.warning("Retry connecting to " + s + ", count " +
retry + '.');
c = (CmdAgent) registry.getService(s);
}
if (c == null) {
logger.severe("Could not connect to " + s);
return (false);
}
cmdp.add(c);
/* Note the agent registration process:
* 1. Create and register the command agent.
* 2. Download benchmark code
* 3. Create the lib classpath
* 4. Create and register file agent
* So it may take quite some time between the registration of
* the command agent and the file agent. But we can be pretty
* sure it'll happen. So just wait. Timeout after 100 retries.
*/
s = Config.FILE_AGENT + "@" + mach;
logger.fine("FileService: Connecting to " + s);
retry = 1;
FileAgent f = (FileAgent) registry.getService(s);
for (; f == null && retry <= 100; retry++) {
Thread.sleep(1000);
logger.fine("Retry obtaining file service from " + s +
", count " + retry + '.');
f = (FileAgent) registry.getService(s);
}
if (f == null) {
logger.severe("Timed out obtaining file service from " + s);
return (false);
}
filep.add(f);
// Added by Ramesh to get the real hostnames of the servers
logger.info("CmdService: Configured " + s + " on server " +
c.getHostName());
return true;
} catch (Exception e) {
logger.log(Level.SEVERE, "Error accessing command agent on system " + mach, e);
return (false);