summaryrefslogtreecommitdiffstats
path: root/gearman/controllerWorker/ControllerWorker/Shutdown.java
diff options
context:
space:
mode:
Diffstat (limited to 'gearman/controllerWorker/ControllerWorker/Shutdown.java')
-rw-r--r--gearman/controllerWorker/ControllerWorker/Shutdown.java28
1 files changed, 15 insertions, 13 deletions
diff --git a/gearman/controllerWorker/ControllerWorker/Shutdown.java b/gearman/controllerWorker/ControllerWorker/Shutdown.java
index 2ed59b6..01c2407 100644
--- a/gearman/controllerWorker/ControllerWorker/Shutdown.java
+++ b/gearman/controllerWorker/ControllerWorker/Shutdown.java
@@ -35,7 +35,7 @@ public class Shutdown extends Thread {
private HashMap<Integer, GearmanJob> whoJobs;
private HashMap<Integer, GearmanJob> shutdownJobs;
private HashMap<Integer, GearmanJob> pingShutdownJobs;
- private HashMap<Integer, GearmanJob> checkStatusJobs;
+ private HashMap<Integer, GearmanJob> topJobs;
private HashMap<Integer, Integer> status;
private HashMap<Integer, String> errors;
private HashMap<Integer, Long> pingShutdownTime;
@@ -51,7 +51,7 @@ public class Shutdown extends Thread {
this.whoJobs = new HashMap<Integer, GearmanJob>();
this.shutdownJobs = new HashMap<Integer, GearmanJob>();
this.pingShutdownJobs = new HashMap<Integer, GearmanJob>();
- this.checkStatusJobs = new HashMap<Integer, GearmanJob>();
+ this.topJobs = new HashMap<Integer, GearmanJob>();
this.status = new HashMap<Integer, Integer>();
this.errors = new HashMap<Integer, String>();
this.updateRate = updateRate; // updates per second
@@ -298,12 +298,12 @@ public class Shutdown extends Thread {
break;
case 9:
- checkStatus(client);
+ top(client);
break;
case 10:
- GearmanJob checkStatusJob = checkStatusJobs.get(clientID);
+ GearmanJob checkStatusJob = topJobs.get(clientID);
if (checkStatusJob != null) {
GearmanJobStatus jobStatus = gearmanClient
@@ -319,15 +319,16 @@ public class Shutdown 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, 11); // is working
- checkStatusJobs.remove(clientID);
+ topJobs.remove(clientID);
} else {
System.out.println(ipAddress
+ " is not working");
status.put(clientID, 4); // is not working
- checkStatusJobs.remove(clientID);
+ topJobs.remove(clientID);
}
} else {
System.out.println(ipAddress
@@ -337,7 +338,7 @@ public class Shutdown extends Thread {
"The check if a user is working has been failed.");
// cannot check if user is working, go in errorState
status.put(clientID, 12);
- checkStatusJobs.remove(clientID);
+ topJobs.remove(clientID);
}
}
}
@@ -345,6 +346,7 @@ public class Shutdown extends Thread {
break;
case 11:
+ System.out.println("User is working Logik");
break;
@@ -432,18 +434,18 @@ public class Shutdown extends Thread {
System.out.println("ping " + 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, 9); // checkStatus started
- checkStatusJobs.put(clientID, job);
+ status.put(clientID, 9); // top started
+ topJobs.put(clientID, job);
- System.out.println("checkStatus " + ipAddress);
+ System.out.println("top " + ipAddress);
}
public String getStatusText(HashMap<String, String> client) {