From 16b79107d0be952bf641889146459a7b296e9a63 Mon Sep 17 00:00:00 2001 From: Björn Geiger Date: Tue, 16 Aug 2011 17:20:16 +0200 Subject: rename worker --- .../ControllerWorker/Shutdown.java | 30 +++++++++++----------- gearman/shutdownWorker.py | 4 +-- 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 pingJobs; private HashMap whoJobs; - private HashMap shutdownJobs; + private HashMap doShutdownJobs; private HashMap pingShutdownJobs; private HashMap psJobs; private HashMap status; @@ -51,7 +51,7 @@ public class Shutdown extends Thread { long waitTime) { this.pingJobs = new HashMap(); this.whoJobs = new HashMap(); - this.shutdownJobs = new HashMap(); + this.doShutdownJobs = new HashMap(); this.pingShutdownJobs = new HashMap(); this.psJobs = new HashMap(); this.status = new HashMap(); @@ -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 client) { + private void doShutdown(HashMap 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 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() -- cgit v1.2.3-55-g7522