From 4a2c3a82869adb6a6bae83a73f9c1ce8ec941424 Mon Sep 17 00:00:00 2001 From: Björn Geiger Date: Mon, 12 Sep 2011 15:35:55 +0200 Subject: Immediate Event funktioniert jetzt --- application/controllers/EventController.php | 67 ++++-- .../controllerWorker/ControllerWorker/Boot.java | 252 +++++++++++---------- .../ControllerWorker/ControllerWorkerMain.java | 2 +- .../ControllerWorker/PoolctrlRequest.java | 2 +- .../ControllerWorker/Shutdown.java | 2 +- 5 files changed, 183 insertions(+), 142 deletions(-) diff --git a/application/controllers/EventController.php b/application/controllers/EventController.php index d758702..f5266b1 100755 --- a/application/controllers/EventController.php +++ b/application/controllers/EventController.php @@ -26,6 +26,17 @@ class EventController extends Zend_Controller_Action public function init() { + $bootstrap = $this->getInvokeArg('bootstrap'); + $this->config = $bootstrap->getOptions(); + $this->pbs2host = $this->config['pbs2']['host']; + $this->gearmanServerHost = $this->config['gearman']['server']['host']; + $this->gearmanServerPort = $this->config['gearman']['server']['port']; + $this->gearmanWorkerWaitTime = $this->config['gearman']['worker']['waitTime']; + $this->gearmanWorkerUpdateRate = $this->config['gearman']['worker']['updateRate']; + $this->gearmanClient = new GearmanClient(); + $this->gearmanClient->addServer($this->gearmanServerHost); + $this->eventMapper = new Application_Model_EventMapper(); + $this->eventcategoryMapper = new Application_Model_EventcategoryMapper(); $actionName = $this->getRequest()->getActionName(); if($actionName == "report" || $actionName == "run") { $this->userIDsNamespace = Zend_Session::namespaceGet('userIDs'); @@ -35,34 +46,17 @@ class EventController extends Zend_Controller_Action $apikey = $this->_request->getParam('apikey'); } if($apikey != ""){ - $bootstrap = $this->getInvokeArg('bootstrap'); - $this->config = $bootstrap->getOptions(); - $this->pbs2host = $this->config['pbs2']['host']; - $this->gearmanServerHost = $this->config['gearman']['server']['host']; - $this->gearmanServerPort = $this->config['gearman']['server']['port']; - $this->gearmanWorkerWaitTime = $this->config['gearman']['worker']['waitTime']; - $this->gearmanWorkerUpdateRate = $this->config['gearman']['worker']['updateRate']; - $this->gearmanClient = new GearmanClient(); - $this->gearmanClient->addServer($this->gearmanServerHost); - $this->eventMapper = new Application_Model_EventMapper(); - $this->eventcategoryMapper = new Application_Model_EventcategoryMapper(); $this->acl = new Poolctrl_Acl($this->pbs2host, $this->config['pbs2']['checkright'] . $apikey, 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); } else { header('HTTP/1.0 401 No apikey is set'); die(); } } else if (Zend_Auth::getInstance()->hasIdentity()) { - $bootstrap = $this->getInvokeArg('bootstrap'); - $this->config = $bootstrap->getOptions(); - $this->pbs2host = $this->config['pbs2']['host']; $this->userIDsNamespace = Zend_Session::namespaceGet('userIDs'); if(isset($this->userIDsNamespace['apikey'])) { $this->acl = new Poolctrl_Acl($this->pbs2host, $this->config['pbs2']['checkright'] . $this->userIDsNamespace['apikey'], 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); } - if($this->userIDsNamespace['membershipID'] !='') { - $this->eventMapper = new Application_Model_EventMapper(); - $this->eventcategoryMapper = new Application_Model_EventcategoryMapper(); - } else { + if(!$this->userIDsNamespace['membershipID'] !='') { $this->_helper->redirector('selectmembership', 'person'); return; } @@ -318,8 +312,18 @@ class EventController extends Zend_Controller_Action $filterentriesXML3 = new SimpleXMLElement($filterentriesXMLString3); $filterentriesID3 = sprintf("%s", $filterentriesXML3->filterentry->id); } - if($params['immediate']) { + if($event->getImmediate()) { + $eventcategoryMapper = new Application_Model_EventcategoryMapper(); + $result = $eventcategoryMapper->fetchAll(); + $eventcategories = array(); + foreach($result as $category) { + $eventcategories[$category->getID()] = $category->getTitle(); + } + $eventCategory = $eventcategories[$event->getCategory()]; + $eventtypeMapper = new Application_Model_EventtypeMapper(); + $eventtype = $eventtypeMapper->findBy(array("title" => $eventCategory)); $event->setRunning(true); + $event->setRunningtype($eventtype[0]->getID()); } else { $event->setRunning(false); } @@ -331,8 +335,8 @@ class EventController extends Zend_Controller_Action echo "Message: " . $e->getMessage() . "
"; return; } - if($params['immediate']) { - $this->runEvent($event); + if($event->getImmediate()) { + $this->runEvent($event, $this->userIDsNamespace['apikey']); } $this->_redirect('/event/'); } @@ -1007,7 +1011,7 @@ class EventController extends Zend_Controller_Action echo $resultString; } - private function runEvent(Application_Model_Event $event) { + private function runEvent(Application_Model_Event $event, $apikey) { $data = array( 'eventName' => $event->getTitle(), ); @@ -1037,6 +1041,25 @@ class EventController extends Zend_Controller_Action } } $data['clients'] = $clients; + $eventcategoryMapper = new Application_Model_EventcategoryMapper(); + $result = $eventcategoryMapper->fetchAll(); + foreach($result as $category) { + $eventcategories[$category->getTitle()] = $category->getID(); + } + $boot = false; + $shutdown = false; + switch($event->getCategory()) { + case $eventcategories['Boot']: + $boot = true; + + break; + + case $eventcategories['Shutdown']: + $shutdown = true; + + break; + } + $eventtypeMapper = new Application_Model_EventtypeMapper(); if($boot) { $bootOsRequest = "bootosid=" . $event->getPbs_bootosID(); $bootOsApiResult = PostToHost($this->pbs2host, $this->config['pbs2']['getbootoss'] . $apikey, 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'poolctrl', $bootOsRequest); diff --git a/gearman/controllerWorker/ControllerWorker/Boot.java b/gearman/controllerWorker/ControllerWorker/Boot.java index f5dec4a..fb1d3aa 100755 --- a/gearman/controllerWorker/ControllerWorker/Boot.java +++ b/gearman/controllerWorker/ControllerWorker/Boot.java @@ -24,7 +24,7 @@ import org.json.simple.JSONValue; import org.apache.log4j.Logger; public class Boot extends Thread { - + static final Logger logger = Logger.getLogger(Boot.class); private String eventName; @@ -32,7 +32,7 @@ public class Boot extends Thread { private String bootOS; private final int updateRate; private long waitTime; - //private Vector psWhitelist; + // private Vector psWhitelist; private Vector psBlacklist; private final GearmanJobServerConnection gearmanConnection; @@ -61,7 +61,7 @@ public class Boot extends Thread { this.bootOS = bootOS; this.waitTime = waitTime * 1000; this.updateRate = updateRate; // updates per second - //this.psWhitelist = psWhitelist; + // this.psWhitelist = psWhitelist; this.psBlacklist = psBlacklist; gearmanConnection = new GearmanNIOJobServerConnection( gearmanServerAddress, gearmanServerPort); @@ -101,7 +101,7 @@ public class Boot extends Thread { timeLeft = (updatePeriod - timeTaken) / 1000000; if (timeLeft < 10) timeLeft = 10; - Thread.sleep(timeLeft); + sleep(timeLeft); } catch (Exception e) { logger.error(e.toString()); } @@ -113,11 +113,9 @@ public class Boot extends Thread { logger.info("Booting of " + eventName + " finished"); } } - + /* - * -------------- - * boot logik - * -------------- + * -------------- boot logik -------------- */ private Boolean update() throws Exception { @@ -157,7 +155,7 @@ public class Boot extends Thread { timestamp = date.getTime(); pingWolTime.put(client.getId(), timestamp); pingWakeOnLan(client); - + break; case PING_WOL_AGAIN: @@ -285,9 +283,7 @@ public class Boot extends Thread { } /* - * ------------------------- - * function declarations - * ------------------------- + * ------------------------- function declarations ------------------------- */ private void ping(Client client) { @@ -301,20 +297,17 @@ public class Boot extends Thread { private void checkPingProgress(Client client) throws Exception, IOException { GearmanJob pingJob = pingJobs.get(client.getId()); - + if (pingJob != null) { - GearmanJobStatus jobStatus = gearmanClient - .getJobStatus(pingJob); + GearmanJobStatus jobStatus = gearmanClient.getJobStatus(pingJob); if (!jobStatus.isKnown() && pingJob.isDone()) { GearmanJobResult pingJobRes = pingJob.get(); - String result = ByteUtils.fromUTF8Bytes(pingJobRes - .getResults()); + String result = ByteUtils + .fromUTF8Bytes(pingJobRes.getResults()); if (!result.isEmpty()) { - JSONObject resultObj = (JSONObject) JSONValue - .parse(result); + JSONObject resultObj = (JSONObject) JSONValue.parse(result); if (!resultObj.containsKey("err")) { - String alive = resultObj.get("alive") - .toString(); + String alive = resultObj.get("alive").toString(); if (alive.equals("true")) { logger.info(client.getIp() + " alive"); client.setState(ClientState.CLIENT_IS_ALIVE); @@ -325,16 +318,18 @@ public class Boot extends Thread { pingJobs.remove(client.getId()); } } else { - logger.error(client.getIp() + " Cannot send the ping message."); - client.setError("Sending the ping message has been failed."); + logger.error(client.getIp() + + " Cannot send the ping message."); + client + .setError("Sending the ping message has been failed."); client.setState(ClientState.BOOT_ERROR); pingJobs.remove(client.getId()); } } } - } - } - + } + } + private void pingWakeOnLan(Client client) { GearmanJob job = GearmanJobImpl.createJob("ping", client.getIp() .getBytes(), "ping" + client.getId()); @@ -343,10 +338,11 @@ public class Boot extends Thread { pingWoLJobs.put(client.getId(), job); logger.info("ping " + client.getIp()); } - - private void checkPingWolProgress(Client client) throws Exception, IOException { + + private void checkPingWolProgress(Client client) throws Exception, + IOException { GearmanJob pingJobWoL = pingWoLJobs.get(client.getId()); - + if (pingJobWoL != null) { Date currentDate = new Date(); Long currentTimestamp = currentDate.getTime(); @@ -357,13 +353,16 @@ public class Boot extends Thread { .getJobStatus(pingJobWoL); if (!jobStatus.isKnown() && pingJobWoL.isDone()) { GearmanJobResult pingJobRes = pingJobWoL.get(); - String result = ByteUtils.fromUTF8Bytes(pingJobRes.getResults()); + String result = ByteUtils.fromUTF8Bytes(pingJobRes + .getResults()); if (!result.isEmpty()) { - JSONObject resultObj = (JSONObject) JSONValue.parse(result); + JSONObject resultObj = (JSONObject) JSONValue + .parse(result); if (!resultObj.containsKey("err")) { String alive = resultObj.get("alive").toString(); if (alive.equals("true")) { - logger.info(client.getIp() + " is alive after WoL"); + logger.info(client.getIp() + + " is alive after WoL"); // alive, go in successState client.setState(ClientState.BOOT_SUCCESS); pingWoLJobs.remove(client.getId()); @@ -373,11 +372,14 @@ public class Boot extends Thread { pingWoLJobs.remove(client.getId()); } } else { - logger.error(client.getIp() + " Cannot send the ping after wake on LAN message."); - client.setError("Sending the ping after wake on LAN message has been failed."); + logger + .error(client.getIp() + + " Cannot send the ping after wake on LAN message."); + client + .setError("Sending the ping after wake on LAN message has been failed."); /* - * sending the ping after wake on LAN - * message has been failed, go to errorState + * sending the ping after wake on LAN message has + * been failed, go to errorState */ client.setState(ClientState.BOOT_ERROR); pingWoLJobs.remove(client.getId()); @@ -391,7 +393,7 @@ public class Boot extends Thread { client.setState(ClientState.BOOT_ERROR); pingWoLJobs.remove(client.getId()); } - } + } } private void pingRestartShutdown(Client client) { @@ -402,28 +404,36 @@ public class Boot extends Thread { pingRestartShutdownJobs.put(client.getId(), job); logger.info("ping " + client.getIp()); } - - private void checkPingRestartShutdownProgress(Client client) throws Exception, IOException { - GearmanJob pingJobRestartShutdown = pingRestartShutdownJobs.get(client.getId()); + + private void checkPingRestartShutdownProgress(Client client) + throws Exception, IOException { + GearmanJob pingJobRestartShutdown = pingRestartShutdownJobs.get(client + .getId()); if (pingJobRestartShutdown != null) { Date currentDate = new Date(); Long currentTimestamp = currentDate.getTime(); // wait 2 min until Restart - Failed - Long expectedTimestamp = pingRestartShutdownTime.get(client.getId()) + waitTime; + Long expectedTimestamp = pingRestartShutdownTime + .get(client.getId()) + + waitTime; if (expectedTimestamp >= currentTimestamp) { - GearmanJobStatus jobStatus = gearmanClient.getJobStatus(pingJobRestartShutdown); - if (!jobStatus.isKnown() - && pingJobRestartShutdown.isDone()) { - GearmanJobResult pingJobRestartRes = pingJobRestartShutdown.get(); - String result = ByteUtils.fromUTF8Bytes(pingJobRestartRes.getResults()); + GearmanJobStatus jobStatus = gearmanClient + .getJobStatus(pingJobRestartShutdown); + if (!jobStatus.isKnown() && pingJobRestartShutdown.isDone()) { + GearmanJobResult pingJobRestartRes = pingJobRestartShutdown + .get(); + String result = ByteUtils.fromUTF8Bytes(pingJobRestartRes + .getResults()); if (!result.isEmpty()) { - JSONObject resultObj = (JSONObject) JSONValue.parse(result); + JSONObject resultObj = (JSONObject) JSONValue + .parse(result); if (!resultObj.containsKey("err")) { String alive = resultObj.get("alive").toString(); if (alive.equals("true")) { logger.info(client.getIp() + " is still alive"); // still alive, ping again - client.setState(ClientState.PING_RESTART_SHUTDOWN_AGAIN); + client + .setState(ClientState.PING_RESTART_SHUTDOWN_AGAIN); pingRestartShutdownJobs.remove(client.getId()); } else if (alive.equals("false")) { logger.info(client.getIp() + " is down"); @@ -432,11 +442,14 @@ public class Boot extends Thread { pingRestartShutdownJobs.remove(client.getId()); } } else { - logger.error(client.getIp() + " Cannot send the ping after restart message."); - client.setError("Sending the ping after restart message has been failed."); + logger + .error(client.getIp() + + " Cannot send the ping after restart message."); + client + .setError("Sending the ping after restart message has been failed."); /* - * sending the ping after restart message - * has been failed + * sending the ping after restart message has been + * failed */ client.setState(ClientState.BOOT_ERROR); pingRestartShutdownJobs.remove(client.getId()); @@ -461,16 +474,16 @@ public class Boot extends Thread { pingRestartBootJobs.put(client.getId(), job); logger.info("ping " + client.getIp()); } - - private void checkPingRestartBootProgress(Client client) throws Exception, IOException { + + private void checkPingRestartBootProgress(Client client) throws Exception, + IOException { GearmanJob pingJobRestartBoot = pingRestartBootJobs.get(client.getId()); - + if (pingJobRestartBoot != null) { Date currentDate = new Date(); Long currentTimestamp = currentDate.getTime(); // wait 2 min until Restart - Failed - Long expectedTimestamp = pingRestartBootTime.get(client - .getId()) + Long expectedTimestamp = pingRestartBootTime.get(client.getId()) + waitTime; if (expectedTimestamp >= currentTimestamp) { GearmanJobStatus jobStatus = gearmanClient @@ -478,46 +491,42 @@ public class Boot extends Thread { if (!jobStatus.isKnown() && pingJobRestartBoot.isDone()) { GearmanJobResult pingJobRestartRes = pingJobRestartBoot .get(); - String result = ByteUtils - .fromUTF8Bytes(pingJobRestartRes - .getResults()); + String result = ByteUtils.fromUTF8Bytes(pingJobRestartRes + .getResults()); if (!result.isEmpty()) { JSONObject resultObj = (JSONObject) JSONValue .parse(result); if (!resultObj.containsKey("err")) { - String alive = resultObj.get("alive") - .toString(); + String alive = resultObj.get("alive").toString(); if (alive.equals("true")) { logger.info(client.getIp() + " is alive after restart"); // alive, go to success state client.setState(ClientState.BOOT_SUCCESS); - pingRestartBootJobs.remove(client - .getId()); + pingRestartBootJobs.remove(client.getId()); } else if (alive.equals("false")) { - logger.info("ping again " - + client.getIp()); + logger.info("ping again " + client.getIp()); // not alive, ping again - client.setState(ClientState.PING_RESTART_BOOT_AGAIN); - pingRestartBootJobs.remove(client - .getId()); + client + .setState(ClientState.PING_RESTART_BOOT_AGAIN); + pingRestartBootJobs.remove(client.getId()); } } else { - logger.error(client.getIp() + logger + .error(client.getIp() + " Cannot send the ping after shutdown message."); client .setError("Sending the ping after shutdown message has been failed."); /* - * sending the ping after shutdown message - * has been failed + * sending the ping after shutdown message has been + * failed */ client.setState(ClientState.BOOT_ERROR); } } } } else { - logger.error(client.getIp() - + " is not alive after reboot"); + logger.error(client.getIp() + " is not alive after reboot"); client.setError("The reboot has been failed."); // not alive, go in errorState client.setState(ClientState.BOOT_ERROR); @@ -534,25 +543,25 @@ public class Boot extends Thread { wolJobs.put(client.getId(), job); logger.info("wake on lan " + client.getMac()); } - - private void checkWakeOnLanProgress(Client client) throws Exception, IOException { + + private void checkWakeOnLanProgress(Client client) throws Exception, + IOException { GearmanJob wolJob = wolJobs.get(client.getId()); - + if (wolJob != null) { - GearmanJobStatus jobStatus = gearmanClient - .getJobStatus(wolJob); + GearmanJobStatus jobStatus = gearmanClient.getJobStatus(wolJob); if (!jobStatus.isKnown() && wolJob.isDone()) { GearmanJobResult wolJobRes = wolJob.get(); - String result = ByteUtils.fromUTF8Bytes(wolJobRes - .getResults()); + String result = ByteUtils.fromUTF8Bytes(wolJobRes.getResults()); if (result.equals("Magic packet send.")) { logger.info(client.getMac() + " Magic packet sent."); client.setState(ClientState.MAGIC_PACKET_SENT); wolJobs.remove(client.getId()); } else { logger.error(client.getIp() + " Cannot send magic packet."); - client.setError("Sending the magic packet has been failed."); + client + .setError("Sending the magic packet has been failed."); // cannot send magic packet, go in errorState client.setState(ClientState.BOOT_ERROR); wolJobs.remove(client.getId()); @@ -569,8 +578,9 @@ public class Boot extends Thread { osJobs.put(client.getId(), job); logger.info("check OS " + client.getIp()); } - - private void checkCheckosProgress(Client client) throws Exception, IOException { + + private void checkCheckosProgress(Client client) throws Exception, + IOException { GearmanJob osJob = osJobs.get(client.getId()); if (osJob != null) { @@ -584,13 +594,12 @@ public class Boot extends Thread { JSONObject resultObj = (JSONObject) JSONValue.parse(result); if (!resultObj.containsKey("err")) { /* - * String release = - * resultObj.get("Release").toString(); String - * distriputorID = + * String release = resultObj.get("Release").toString(); + * String distriputorID = * resultObj.get("Distributor ID").toString(); */ - String description = resultObj.get( - "Description").toString(); + String description = resultObj.get("Description") + .toString(); if (description.equals(bootOS)) { logger.info(client.getIp() + " right OS"); @@ -604,7 +613,8 @@ public class Boot extends Thread { } } else { logger.error(client.getIp() + " Cannot check os"); - client.setError("The check for correct operating system has been failed."); + client + .setError("The check for correct operating system has been failed."); // cannot check os, go in errorState client.setState(ClientState.BOOT_ERROR); osJobs.remove(client.getId()); @@ -636,34 +646,39 @@ public class Boot extends Thread { if (!result.isEmpty()) { JSONObject resultObj = (JSONObject) JSONValue.parse(result); if (!resultObj.containsKey("err")) { - String rawoutput = resultObj.get("rawoutput").toString(); - StringTokenizer str = new StringTokenizer( - rawoutput, " "); + String rawoutput = resultObj.get("rawoutput") + .toString(); + StringTokenizer str = new StringTokenizer(rawoutput, + " "); String user = ""; if (str.hasMoreTokens()) { user = str.nextToken(); } if (user.isEmpty()) { - logger.info(client.getIp() + " no user is logged in -CHECK PS-"); + logger.info(client.getIp() + + " no user is logged in -CHECK PS-"); // no user is logged in, doing restart - //----- + // ----- // didn´t work in test-pool, check ps client.setState(ClientState.A_USER_IS_LOGGED_IN); whoJobs.remove(client.getId()); } else { - logger.info(client.getIp() + " a user is logged in"); + logger + .info(client.getIp() + + " a user is logged in"); client.setState(ClientState.A_USER_IS_LOGGED_IN); whoJobs.remove(client.getId()); } } else { - logger.error(client.getIp() + " Cannot check if a user is logged in."); - client.setError("The check if a user is logged in has been failed."); + logger.error(client.getIp() + + " Cannot check if a user is logged in."); + client + .setError("The check if a user is logged in has been failed."); /* - * cannot check if a user is logged in, go in - * errorState + * cannot check if a user is logged in, go in errorState */ - //client + // client client.setState(ClientState.BOOT_ERROR); whoJobs.remove(client.getId()); } @@ -671,7 +686,7 @@ public class Boot extends Thread { } } } - + private void ps(Client client) { GearmanJob job = GearmanJobImpl.createJob("ps", client.getIp() .getBytes(), "ps" + client.getId()); @@ -680,7 +695,7 @@ public class Boot extends Thread { psJobs.put(client.getId(), job); logger.info("ps " + client.getIp()); } - + private void checkPsProgress(Client client) throws Exception, IOException { GearmanJob psJob = psJobs.get(client.getId()); @@ -706,15 +721,14 @@ public class Boot extends Thread { /* * for (String whiteEntry : psWhitelist) { if - * (ps.toString().contains(whiteEntry)) { - * whitelistFound = true; } } + * (ps.toString().contains(whiteEntry)) { whitelistFound + * = true; } } */ if (blacklistFound) { /* - * if (whitelistFound) { - * logger.info(client.getIp() + - * " is not working"); // is not working + * if (whitelistFound) { logger.info(client.getIp() + * + " is not working"); // is not working * status.put(client.getId(), 13); * psJobs.remove(client.getId()); } else { */ @@ -728,11 +742,12 @@ public class Boot extends Thread { psJobs.remove(client.getId()); } } else { - logger.error(client.getIp() + " Cannot check if user is working."); - client.setError("The check if a user is working has been failed."); + logger.error(client.getIp() + + " Cannot check if user is working."); + client + .setError("The check if a user is working has been failed."); /* - * cannot check if user is working, go in - * errorState + * cannot check if user is working, go in errorState */ client.setState(ClientState.BOOT_ERROR); psJobs.remove(client.getId()); @@ -750,10 +765,11 @@ public class Boot extends Thread { restartJobs.put(client.getId(), job); logger.info("restart " + client.getIp()); } - - private void checkRestartProgress(Client client) throws Exception, IOException { + + private void checkRestartProgress(Client client) throws Exception, + IOException { GearmanJob restartJob = restartJobs.get(client.getId()); - + if (restartJob != null) { GearmanJobStatus jobStatus = gearmanClient.getJobStatus(restartJob); @@ -767,8 +783,10 @@ public class Boot extends Thread { client.setState(ClientState.RESTART_COMMAND_SENT); restartJobs.remove(client.getId()); } else { - logger.error(client.getIp() + " Cannot send restart command"); - client.setError("Sending the restart command has been failed."); + logger.error(client.getIp() + + " Cannot send restart command"); + client + .setError("Sending the restart command has been failed."); // cannot send restart command, go in errorState client.setState(ClientState.BOOT_ERROR); restartJobs.remove(client.getId()); diff --git a/gearman/controllerWorker/ControllerWorker/ControllerWorkerMain.java b/gearman/controllerWorker/ControllerWorker/ControllerWorkerMain.java index 49ea2ab..b326c72 100755 --- a/gearman/controllerWorker/ControllerWorker/ControllerWorkerMain.java +++ b/gearman/controllerWorker/ControllerWorker/ControllerWorkerMain.java @@ -19,7 +19,7 @@ public class ControllerWorkerMain { worker.addServer(connection); BasicConfigurator.configure(); PoolctrlRequest poolctrlRequest = new PoolctrlRequest(); - poolctrlRequest.run(); + poolctrlRequest.start(); worker.work(); } } \ No newline at end of file diff --git a/gearman/controllerWorker/ControllerWorker/PoolctrlRequest.java b/gearman/controllerWorker/ControllerWorker/PoolctrlRequest.java index 373d2e2..102c762 100755 --- a/gearman/controllerWorker/ControllerWorker/PoolctrlRequest.java +++ b/gearman/controllerWorker/ControllerWorker/PoolctrlRequest.java @@ -48,7 +48,7 @@ public class PoolctrlRequest extends Thread { timeLeft = (updatePeriod - timeTaken) / 1000000; if (timeLeft < 10) timeLeft = 10; - Thread.sleep(timeLeft); + sleep(timeLeft); } catch (Exception e) { logger.error(e.toString()); } diff --git a/gearman/controllerWorker/ControllerWorker/Shutdown.java b/gearman/controllerWorker/ControllerWorker/Shutdown.java index a3e5386..7b6816d 100755 --- a/gearman/controllerWorker/ControllerWorker/Shutdown.java +++ b/gearman/controllerWorker/ControllerWorker/Shutdown.java @@ -87,7 +87,7 @@ public class Shutdown extends Thread { timeLeft = (updatePeriod - timeTaken) / 1000000; if (timeLeft < 10) timeLeft = 10; - Thread.sleep(timeLeft); + sleep(timeLeft); } catch (Exception e) { logger.error(e.toString()); } -- cgit v1.2.3-55-g7522