this.inputFiles.put("properties.txt", properties);
}
public synchronized void run() {
Registry remoteRegistry;
NBOServerIF server;
String address = settings.get("server_address");
int port = Integer.parseInt(settings.get("server_port"));
long solutionSleep = Long.parseLong(this.settings.get("solution_sleep"));
HashMap<String, String> resultMap = null;
HashMap<Integer, String> log = null;
HashMap<Integer, Result> resultObject = null;
String resultString = null;
try {
remoteRegistry = LocateRegistry.getRegistry(address, port, new SslRMIClientSocketFactory());
ClientLogManager.addClientLog(remoteRegistry.toString(), false);
server = (NBOServerIF) remoteRegistry.lookup("NBOServer");
ClientLogManager.addClientLog(server.toString(), false);
if(!server.login(this.user)) {
this.stop = true;
this.raProblem.setState(Model.FAILED);
ClientLogManager.addClientLog("Access denied for user " + this.user + "!", true);
return;
}
if (!this.raProblem.isSentToServer()) {
server.compute(this.user, this.raProblem.getName(), inputFiles, Model.RES_ALLOC);
this.raProblem.setState(Model.SENT_TO_SERVER);
}
while (resultObject == null) {
if (this.stop) {
return;
}
resultObject = server.isReady(this.user, this.raProblem.getName(), this.raProblem.getUniqueID());
sleep(solutionSleep * 1000);
}
resultMap = resultObject.get(this.raProblem.getUniqueID()).getResultMap();
log = server.getLog(this.user, this.raProblem.getName(), this.raProblem.getUniqueID());
resultString = resultMap.get(this.raProblem.getName());
if ((resultString.equals("")) || (resultString == null)) {
throw new Exception("Result from server is empty!");
}