summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjörn Geiger2011-08-16 17:20:16 +0200
committerBjörn Geiger2011-08-16 17:20:16 +0200
commit16b79107d0be952bf641889146459a7b296e9a63 (patch)
tree285293b179cd749f7eeb52b9f88117fa4e889a43
parentminor (diff)
downloadpoolctrl-16b79107d0be952bf641889146459a7b296e9a63.tar.gz
poolctrl-16b79107d0be952bf641889146459a7b296e9a63.tar.xz
poolctrl-16b79107d0be952bf641889146459a7b296e9a63.zip
rename worker
-rw-r--r--gearman/controllerWorker/ControllerWorker/Shutdown.java30
-rwxr-xr-xgearman/shutdownWorker.py4
2 files changed, 17 insertions, 17 deletions
diff --git a/gearman/controllerWorker/ControllerWorker/Shutdown.java b/gearman/controllerWorker/ControllerWorker/Shutdown.java
index 3c0dca9..70582e6 100644
--- a/gearman/controllerWorker/ControllerWorker/Shutdown.java
+++ b/gearman/controllerWorker/ControllerWorker/Shutdown.java
@@ -34,7 +34,7 @@ public class Shutdown extends Thread {
private HashMap<Integer, GearmanJob> pingJobs;
private HashMap<Integer, GearmanJob> whoJobs;
- private HashMap<Integer, GearmanJob> shutdownJobs;
+ private HashMap<Integer, GearmanJob> doShutdownJobs;
private HashMap<Integer, GearmanJob> pingShutdownJobs;
private HashMap<Integer, GearmanJob> psJobs;
private HashMap<Integer, Integer> status;
@@ -51,7 +51,7 @@ public class Shutdown extends Thread {
long waitTime) {
this.pingJobs = new HashMap<Integer, GearmanJob>();
this.whoJobs = new HashMap<Integer, GearmanJob>();
- this.shutdownJobs = new HashMap<Integer, GearmanJob>();
+ this.doShutdownJobs = new HashMap<Integer, GearmanJob>();
this.pingShutdownJobs = new HashMap<Integer, GearmanJob>();
this.psJobs = new HashMap<Integer, GearmanJob>();
this.status = new HashMap<Integer, Integer>();
@@ -224,18 +224,18 @@ public class Shutdown extends Thread {
break;
case 4:
- shutdown(client);
+ doShutdown(client);
break;
case 5:
- GearmanJob shutdownJob = shutdownJobs.get(clientID);
- if (shutdownJob != null) {
+ GearmanJob doShutdownJob = doShutdownJobs.get(clientID);
+ if (doShutdownJob != null) {
GearmanJobStatus jobStatus = gearmanClient
- .getJobStatus(shutdownJob);
+ .getJobStatus(doShutdownJob);
- if (!jobStatus.isKnown() && shutdownJob.isDone()) {
- GearmanJobResult wolJobRes = shutdownJob.get();
+ if (!jobStatus.isKnown() && doShutdownJob.isDone()) {
+ GearmanJobResult wolJobRes = doShutdownJob.get();
String result = ByteUtils.fromUTF8Bytes(wolJobRes
.getResults());
if (!result.isEmpty()) {
@@ -246,7 +246,7 @@ public class Shutdown extends Thread {
+ " Shutdown command send");
status.put(clientID, 6); // shutdown command
// send
- shutdownJobs.remove(clientID);
+ doShutdownJobs.remove(clientID);
} else {
System.out.println(ipAddress
+ " Cannot send shutdown command");
@@ -256,7 +256,7 @@ public class Shutdown extends Thread {
// cannot send shutdown command, go in
// errorState
status.put(clientID, 12);
- shutdownJobs.remove(clientID);
+ doShutdownJobs.remove(clientID);
}
}
}
@@ -453,18 +453,18 @@ public class Shutdown extends Thread {
System.out.println("who " + ipAddress);
}
- private void shutdown(HashMap<String, String> client) {
+ private void doShutdown(HashMap<String, String> client) {
String ipAddress = client.get("ip");
int clientID = Integer.parseInt(client.get("id"));
- GearmanJob job = GearmanJobImpl.createJob("shutdown", ipAddress
- .getBytes(), "shutdown" + clientID);
+ GearmanJob job = GearmanJobImpl.createJob("doShutdown", ipAddress
+ .getBytes(), "doShutdown" + clientID);
gearmanClient.submit(job);
status.put(clientID, 5); // shutdown started
- shutdownJobs.put(clientID, job);
+ doShutdownJobs.put(clientID, job);
- System.out.println("shutdown " + ipAddress);
+ System.out.println("doShutdown " + ipAddress);
}
private void pingShutdown(HashMap<String, String> client) {
diff --git a/gearman/shutdownWorker.py b/gearman/shutdownWorker.py
index d73a0bd..d0a7e44 100755
--- a/gearman/shutdownWorker.py
+++ b/gearman/shutdownWorker.py
@@ -65,5 +65,5 @@ def shutdownWorker(worker, job):
worker = GearmanWorker(["127.0.0.1"])
-worker.register_task('shutdown', shutdownWorker)
-worker.work() \ No newline at end of file
+worker.register_task('doShutdown', shutdownWorker)
+worker.work()