summaryrefslogtreecommitdiffstats
path: root/gearman/controllerWorker/ControllerWorker/Boot.java
diff options
context:
space:
mode:
Diffstat (limited to 'gearman/controllerWorker/ControllerWorker/Boot.java')
-rw-r--r--gearman/controllerWorker/ControllerWorker/Boot.java27
1 files changed, 14 insertions, 13 deletions
diff --git a/gearman/controllerWorker/ControllerWorker/Boot.java b/gearman/controllerWorker/ControllerWorker/Boot.java
index faa75d3..462d888 100644
--- a/gearman/controllerWorker/ControllerWorker/Boot.java
+++ b/gearman/controllerWorker/ControllerWorker/Boot.java
@@ -37,7 +37,7 @@ public class Boot extends Thread {
private HashMap<Integer, GearmanJob> pingWoLJobs;
private HashMap<Integer, GearmanJob> osJobs;
private HashMap<Integer, GearmanJob> whoJobs;
- private HashMap<Integer, GearmanJob> checkStatusJobs;
+ private HashMap<Integer, GearmanJob> topJobs;
private HashMap<Integer, GearmanJob> restartJobs;
private HashMap<Integer, GearmanJob> pingRestartJobs;
private HashMap<Integer, Integer> status;
@@ -58,7 +58,7 @@ public class Boot extends Thread {
this.wolJobs = new HashMap<Integer, GearmanJob>();
this.osJobs = new HashMap<Integer, GearmanJob>();
this.whoJobs = new HashMap<Integer, GearmanJob>();
- this.checkStatusJobs = new HashMap<Integer, GearmanJob>();
+ this.topJobs = new HashMap<Integer, GearmanJob>();
this.restartJobs = new HashMap<Integer, GearmanJob>();
this.pingRestartJobs = new HashMap<Integer, GearmanJob>();
this.status = new HashMap<Integer, Integer>();
@@ -377,12 +377,12 @@ public class Boot extends Thread {
break;
case 11:
- checkStatus(client);
+ top(client);
break;
case 12:
- GearmanJob checkStatusJob = checkStatusJobs.get(clientID);
+ GearmanJob checkStatusJob = topJobs.get(clientID);
if (checkStatusJob != null) {
GearmanJobStatus jobStatus = gearmanClient
@@ -398,15 +398,16 @@ public class Boot extends Thread {
.parse(result);
String rawoutput = resultObj.get("rawoutput")
.toString();
+ System.out.println(rawoutput);
if (rawoutput.equals("is working")) {
System.out.println(ipAddress + " is working");
status.put(clientID, 18); // is working
- checkStatusJobs.remove(clientID);
+ topJobs.remove(clientID);
} else {
System.out.println(ipAddress
+ " is not working");
status.put(clientID, 13); // is not working
- checkStatusJobs.remove(clientID);
+ topJobs.remove(clientID);
}
} else {
System.out.println(ipAddress
@@ -416,7 +417,7 @@ public class Boot extends Thread {
"The check if a user is working has been failed.");
// cannot check if user is working, go in errorState
status.put(clientID, 19);
- checkStatusJobs.remove(clientID);
+ topJobs.remove(clientID);
}
}
}
@@ -635,18 +636,18 @@ public class Boot extends Thread {
System.out.println("who " + ipAddress);
}
- private void checkStatus(HashMap<String, String> client) {
+ private void top(HashMap<String, String> client) {
String ipAddress = client.get("ip");
int clientID = Integer.parseInt(client.get("id"));
- GearmanJob job = GearmanJobImpl.createJob("checkStatus", ipAddress
- .getBytes(), "checkStatus" + clientID);
+ GearmanJob job = GearmanJobImpl.createJob("top", ipAddress.getBytes(),
+ "top" + clientID);
gearmanClient.submit(job);
- status.put(clientID, 12); // checkStatus started
- checkStatusJobs.put(clientID, job);
+ status.put(clientID, 12); // top started
+ topJobs.put(clientID, job);
- System.out.println("checkStatus " + ipAddress);
+ System.out.println("top " + ipAddress);
}
private void restart(HashMap<String, String> client) {