From e6f695cdac26c5fe0e7b6bab26b669d2b09544ee Mon Sep 17 00:00:00 2001 From: Björn Geiger Date: Wed, 10 Aug 2011 13:09:14 +0200 Subject: minor --- .../controllerWorker/ControllerWorker/Boot.java | 22 +++++----- .../ControllerWorker/Shutdown.java | 51 ++++++++-------------- 2 files changed, 28 insertions(+), 45 deletions(-) (limited to 'gearman') diff --git a/gearman/controllerWorker/ControllerWorker/Boot.java b/gearman/controllerWorker/ControllerWorker/Boot.java index 3fe6a05..3d2db11 100644 --- a/gearman/controllerWorker/ControllerWorker/Boot.java +++ b/gearman/controllerWorker/ControllerWorker/Boot.java @@ -80,26 +80,26 @@ public class Boot extends Thread { this.error = false; this.bootOS = bootOS; this.statusText = new String[20]; - this.statusText[0] = "Booting has been started."; - this.statusText[1] = "Ping has been started."; - this.statusText[2] = "Client is alive."; - this.statusText[3] = "Client is not alive."; - this.statusText[4] = "Wake on LAN has been started."; - this.statusText[5] = "Magic packet has been send."; - this.statusText[6] = "Ping after wake on LAN has been started."; + this.statusText[0] = "The booting process of the client has been started."; + this.statusText[1] = "The ping has been started."; + this.statusText[2] = "The client is alive."; + this.statusText[3] = "The client is not alive."; + this.statusText[4] = "The wake on LAN has been started."; + this.statusText[5] = "The Magic packet has been send."; + this.statusText[6] = "The ping after wake on LAN has been started."; this.statusText[7] = "Doing ping after wake on LAN again and again, until client is alive or two minutes has been elapsed"; this.statusText[8] = "The check for the correct operating system has been started."; - this.statusText[9] = "Wrong operating system is running."; + this.statusText[9] = "The wrong operating system is running."; this.statusText[10] = "The check if a user is logged in has been started."; this.statusText[11] = "A user is logged in."; this.statusText[12] = "The check if the user is working has been started."; this.statusText[13] = "The user is not working."; this.statusText[14] = "A restart of the client has been triggered."; - this.statusText[15] = "Ping after restart has been started."; + this.statusText[15] = "The ping after restart has been started."; this.statusText[16] = "Doing ping after restart again and again, until client is alive or two minutes has been elapsed"; this.statusText[17] = "The user is working."; - this.statusText[18] = "Booting has not been finished, due to an error."; - this.statusText[19] = "Booting has been finished."; + this.statusText[18] = "Booting of the client has not been finished, due to an error."; + this.statusText[19] = "Booting of the client has been finished."; } public void run() { diff --git a/gearman/controllerWorker/ControllerWorker/Shutdown.java b/gearman/controllerWorker/ControllerWorker/Shutdown.java index b174156..1058464 100644 --- a/gearman/controllerWorker/ControllerWorker/Shutdown.java +++ b/gearman/controllerWorker/ControllerWorker/Shutdown.java @@ -28,6 +28,7 @@ public class Shutdown extends Thread { private Boolean error; private final int updateRate; private final long updatePeriod; + private String[] statusText; private HashMap pingJobs; private HashMap whoJobs; @@ -35,7 +36,7 @@ public class Shutdown extends Thread { private HashMap pingShutdownJobs; private HashMap sshJobs; private HashMap status; - private HashMap errors; + private HashMap errors; private HashMap pingShutdownTime; private Vector> clients; @@ -50,7 +51,7 @@ public class Shutdown extends Thread { this.shutdownJobs = new HashMap(); this.sshJobs = new HashMap(); this.status = new HashMap(); - this.errors = new HashMap(); + this.errors = new HashMap(); this.updateRate = updateRate; // updates per second this.updatePeriod = 1000000000L / this.updateRate; // nanoseconds this.gearmanConnection = new GearmanNIOJobServerConnection( @@ -64,6 +65,8 @@ public class Shutdown extends Thread { } this.finished = false; this.error = false; + this.statusText = new String[20]; + this.statusText[0] = "The shutdown process of the client has been started."; } public void run() { @@ -298,40 +301,16 @@ public class Shutdown extends Thread { System.out.println("ssh " + ipAddress); } - public Vector> getClients() { - return clients; - } - - public GearmanClient getGearmanClient() { - return gearmanClient; - } - - public GearmanJobServerConnection getGearmanConnection() { - return gearmanConnection; - } - - public HashMap getPingJobs() { - return pingJobs; - } - - public HashMap getSshJobs() { - return sshJobs; - } - - public HashMap getWhoJobs() { - return whoJobs; - } - - public HashMap getShutdownJobs() { - return shutdownJobs; - } - - public HashMap getStatus() { - return status; + public String getStatusText(HashMap client) { + int clientID = Integer.parseInt(client.get("id")); + int clientStatus = this.status.get(clientID); + return this.statusText[clientStatus]; } - public HashMap getErrors() { - return errors; + public String getError(HashMap client) { + int clientID = Integer.parseInt(client.get("id")); + String clientError = this.errors.get(clientID); + return clientError; } public Boolean isFinished() { @@ -341,4 +320,8 @@ public class Shutdown extends Thread { public Boolean isFinishedWithErrors() { return finished && error; } + + public Vector> getClients() { + return clients; + } } \ No newline at end of file -- cgit v1.2.3-55-g7522