summaryrefslogtreecommitdiffstats
path: root/gearman/controllerWorker/ControllerWorker/Boot.java
diff options
context:
space:
mode:
authorBjörn Geiger2011-08-10 15:03:28 +0200
committerBjörn Geiger2011-08-10 15:03:28 +0200
commit98e6edac52352e7823db66f97ee73f701e69b438 (patch)
treecc1ab5b2333e8f5f12a6e2a5490d5a097ef02b15 /gearman/controllerWorker/ControllerWorker/Boot.java
parentminor (diff)
downloadpoolctrl-98e6edac52352e7823db66f97ee73f701e69b438.tar.gz
poolctrl-98e6edac52352e7823db66f97ee73f701e69b438.tar.xz
poolctrl-98e6edac52352e7823db66f97ee73f701e69b438.zip
verschiedene Korrekturen
Diffstat (limited to 'gearman/controllerWorker/ControllerWorker/Boot.java')
-rw-r--r--gearman/controllerWorker/ControllerWorker/Boot.java62
1 files changed, 50 insertions, 12 deletions
diff --git a/gearman/controllerWorker/ControllerWorker/Boot.java b/gearman/controllerWorker/ControllerWorker/Boot.java
index 3d2db11..4a3f8a4 100644
--- a/gearman/controllerWorker/ControllerWorker/Boot.java
+++ b/gearman/controllerWorker/ControllerWorker/Boot.java
@@ -253,11 +253,11 @@ public class Boot extends Thread {
// alive, go in successState
status.put(clientID, 19);
pingWoLJobs.remove(clientID);
- } else {
+ } else
System.out.println("ping again "
+ ipAddress);
- status.put(clientID, 6); // again ping
- }
+ status.put(clientID, 6); // again ping
+ pingWoLJobs.remove(clientID);
}
}
} else {
@@ -299,11 +299,11 @@ public class Boot extends Thread {
if (description.equals(this.bootOS)) {
System.out.println(ipAddress + " right OS");
status.put(clientID, 19); // right os
- pingJobs.remove(clientID);
+ osJobs.remove(clientID);
} else {
System.out.println(ipAddress + " wrong OS");
status.put(clientID, 9); // wrong os
- pingJobs.remove(clientID);
+ osJobs.remove(clientID);
}
} else {
System.out.println(ipAddress + " Cannot check os");
@@ -312,7 +312,7 @@ public class Boot extends Thread {
"The check for correct operating system has been failed.");
// cannot check os, go in errorState
status.put(clientID, 18);
- pingWoLJobs.remove(clientID);
+ osJobs.remove(clientID);
}
}
}
@@ -351,11 +351,11 @@ public class Boot extends Thread {
if (user.isEmpty()) {
System.out.println(ipAddress + " right User");
status.put(clientID, 13); // right user
- pingJobs.remove(clientID);
+ whoJobs.remove(clientID);
} else {
System.out.println(ipAddress + " wrong User");
status.put(clientID, 11); // wrong user
- pingJobs.remove(clientID);
+ whoJobs.remove(clientID);
}
} else {
System.out.println(ipAddress
@@ -368,7 +368,7 @@ public class Boot extends Thread {
* errorState
*/
status.put(clientID, 18);
- pingWoLJobs.remove(clientID);
+ whoJobs.remove(clientID);
}
}
}
@@ -381,7 +381,44 @@ public class Boot extends Thread {
break;
case 12:
- System.out.println("Status Logik");
+ GearmanJob checkStatusJob = checkStatusJobs.get(clientID);
+
+ if (checkStatusJob != null) {
+ GearmanJobStatus jobStatus = gearmanClient
+ .getJobStatus(checkStatusJob);
+
+ if (!jobStatus.isKnown() && checkStatusJob.isDone()) {
+ GearmanJobResult whoJobRes = checkStatusJob.get();
+ String result = ByteUtils.fromUTF8Bytes(whoJobRes
+ .getResults());
+
+ if (result != "") {
+ JSONObject resultObj = (JSONObject) JSONValue
+ .parse(result);
+ String rawoutput = resultObj.get("rawoutput")
+ .toString();
+ if (rawoutput.equals("is working")) {
+ System.out.println(ipAddress + " is working");
+ status.put(clientID, 17); // is working
+ checkStatusJobs.remove(clientID);
+ } else {
+ System.out.println(ipAddress
+ + " is not working");
+ status.put(clientID, 13); // is not working
+ checkStatusJobs.remove(clientID);
+ }
+ } else {
+ System.out.println(ipAddress
+ + " Cannot check if user is working.");
+ this.errors
+ .put(clientID,
+ "The check if a user is working has been failed.");
+ // cannot check if user is working, go in errorState
+ status.put(clientID, 18);
+ checkStatusJobs.remove(clientID);
+ }
+ }
+ }
break;
@@ -427,11 +464,12 @@ public class Boot extends Thread {
+ " is alive after restart");
// alive, go in successState
status.put(clientID, 19);
- pingWoLJobs.remove(clientID);
+ pingRestartJobs.remove(clientID);
} else {
System.out.println("ping again "
+ ipAddress);
status.put(clientID, 15); // again ping
+ pingRestartJobs.remove(clientID);
}
}
}
@@ -441,7 +479,7 @@ public class Boot extends Thread {
this.errors.put(clientID,
"The restart has been failed.");
status.put(clientID, 18); // not alive, go in errorState
- pingWoLJobs.remove(clientID);
+ pingRestartJobs.remove(clientID);
}
}