summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xgearman/controllerWorker/ControllerWorker/BootWorker.java2
-rwxr-xr-xgearman/controllerWorker/ControllerWorker/Client.java2
-rwxr-xr-xgearman/controllerWorker/ControllerWorker/ShutdownWorker.java2
-rwxr-xr-xgearman/controllerWorker/ControllerWorker/StatusWorker.java42
4 files changed, 26 insertions, 22 deletions
diff --git a/gearman/controllerWorker/ControllerWorker/BootWorker.java b/gearman/controllerWorker/ControllerWorker/BootWorker.java
index e9021e5..8d3e612 100755
--- a/gearman/controllerWorker/ControllerWorker/BootWorker.java
+++ b/gearman/controllerWorker/ControllerWorker/BootWorker.java
@@ -79,7 +79,7 @@ public class BootWorker extends AbstractGearmanFunction {
jsonData.put("eventName", event);
jsonData.put("type", "createBootState");
jsonData.put("eventOS", eventOS);
- jsonData.put("clients", jsonClients.toArray());
+ jsonData.put("clients", jsonClients);
String dataString = JSONValue.toJSONString(jsonData);
GearmanJob job = GearmanJobImpl.createJob("status", dataString
.getBytes(), "status" + event);
diff --git a/gearman/controllerWorker/ControllerWorker/Client.java b/gearman/controllerWorker/ControllerWorker/Client.java
index deb3246..46b627b 100755
--- a/gearman/controllerWorker/ControllerWorker/Client.java
+++ b/gearman/controllerWorker/ControllerWorker/Client.java
@@ -133,7 +133,7 @@ public class Client {
jsonData.put("eventName", eventName);
jsonData.put("clientID", id);
jsonData.put("error", error);
- jsonData.put("newState", state.toString());
+ jsonData.put("newState", state.name());
String dataString = JSONValue.toJSONString(jsonData);
GearmanJob job = GearmanJobImpl.createJob("status", dataString
.getBytes(), "status" + eventName);
diff --git a/gearman/controllerWorker/ControllerWorker/ShutdownWorker.java b/gearman/controllerWorker/ControllerWorker/ShutdownWorker.java
index 654c07f..631e8b7 100755
--- a/gearman/controllerWorker/ControllerWorker/ShutdownWorker.java
+++ b/gearman/controllerWorker/ControllerWorker/ShutdownWorker.java
@@ -77,7 +77,7 @@ public class ShutdownWorker extends AbstractGearmanFunction {
LinkedHashMap<String, Object> jsonData = new LinkedHashMap<String, Object>();
jsonData.put("eventName", event);
jsonData.put("type", "createShutdownState");
- jsonData.put("clients", jsonClients.toArray());
+ jsonData.put("clients", jsonClients);
String dataString = JSONValue.toJSONString(jsonData);
GearmanJob job = GearmanJobImpl.createJob("status", dataString
.getBytes(), "status" + event);
diff --git a/gearman/controllerWorker/ControllerWorker/StatusWorker.java b/gearman/controllerWorker/ControllerWorker/StatusWorker.java
index 75bca69..4700dbe 100755
--- a/gearman/controllerWorker/ControllerWorker/StatusWorker.java
+++ b/gearman/controllerWorker/ControllerWorker/StatusWorker.java
@@ -17,8 +17,8 @@ import org.json.simple.JSONValue;
public class StatusWorker extends AbstractGearmanFunction {
// private static final Logger logger = ControllerWorkerMain.getLogger();
- private HashMap<String, BootState> BOOTSTATES = new HashMap<String, BootState>();
- private HashMap<String, ShutdownState> SHUTDOWNSTATES = new HashMap<String, ShutdownState>();
+ private static final HashMap<String, BootState> BOOTSTATES = new HashMap<String, BootState>();
+ private static final HashMap<String, ShutdownState> SHUTDOWNSTATES = new HashMap<String, ShutdownState>();
@Override
public String getName() {
@@ -29,23 +29,27 @@ public class StatusWorker extends AbstractGearmanFunction {
public GearmanJobResult executeFunction() {
String data = ByteUtils.fromUTF8Bytes((byte[]) this.data);
JSONObject jsonObject = (JSONObject) JSONValue.parse(data);
- String type = jsonObject.get("type").toString();
- if (type == "getBootState") {
- return getBootState(jsonObject);
- } else if (type == "getShutdownState") {
- return getShutdownState(jsonObject);
- } else if (type == "updateClientStateBoot") {
- return updateClientStateBoot(jsonObject);
- } else if (type == "updateClientStateShutdown") {
- return updateClientStateShutdown(jsonObject);
- } else if (type == "createBootState") {
- return createBootState(jsonObject);
- } else if (type == "createShutdownState") {
- return createShutdownState(jsonObject);
- } else if (type == "finishBootState") {
- return finishBootState(jsonObject);
- } else if (type == "finishShutdownState") {
- return finishShutdownState(jsonObject);
+ if (jsonObject != null) {
+ String type = jsonObject.get("type").toString();
+ if (type.equals("getBootState")) {
+ return getBootState(jsonObject);
+ } else if (type.equals("getShutdownState")) {
+ return getShutdownState(jsonObject);
+ } else if (type.equals("updateClientStateBoot")) {
+ return updateClientStateBoot(jsonObject);
+ } else if (type.equals("updateClientStateShutdown")) {
+ return updateClientStateShutdown(jsonObject);
+ } else if (type.equals("createBootState")) {
+ return createBootState(jsonObject);
+ } else if (type.equals("createShutdownState")) {
+ return createShutdownState(jsonObject);
+ } else if (type.equals("finishBootState")) {
+ return finishBootState(jsonObject);
+ } else if (type.equals("finishShutdownState")) {
+ return finishShutdownState(jsonObject);
+ } else {
+ return null;
+ }
} else {
return null;
}