--- projects/cms/source/host/java/JavaHost.java 2001/01/24 01:25:59 1.6 +++ projects/cms/source/host/java/JavaHost.java 2001/03/19 17:30:17 1.7 @@ -7,8 +7,8 @@ * Designed to be used as a working design to build the C++ hosts on. * Hopefully fully functional and thus can be used as part of a test rig. * - * @author $Author: tdb $ - * @version $Id: JavaHost.java,v 1.6 2001/01/24 01:25:59 tdb Exp $ + * @author $Author: ab11 $ + * @version $Id: JavaHost.java,v 1.7 2001/03/19 17:30:17 ab11 Exp $ */ class JavaHost { @@ -36,23 +36,23 @@ class JavaHost { SystemMonitor sysMon = new SystemMonitor(config); try { - udpcheckInterval = Long.parseLong(config.getProperty("UDPUpdateTime")) * 1000; - System.out.println("Configured UDPUpdateTime"); + udpcheckInterval = Long.parseLong(config.getProperty("UDPUpdateTime")) * 1000; + System.out.println("Configured UDPUpdateTime"); } catch ( NumberFormatException e ){ - System.out.println("The value for UDPUpdateTime is invalid, using a default"); - // 1 mins - udpcheckInterval = 1000 * 60; // 1 minute + System.out.println("The value for UDPUpdateTime is invalid, using a default"); + // 1 mins + udpcheckInterval = 1000 * 60; // 1 minute } try { - tcpcheckInterval = Long.parseLong(config.getProperty("TCPUpdateTime")) * 1000; - System.out.println("Configured TCPUpdateTime"); + tcpcheckInterval = Long.parseLong(config.getProperty("TCPUpdateTime")) * 1000; + System.out.println("Configured TCPUpdateTime"); } catch ( NumberFormatException e ){ - System.out.println("The value for UDPUpdateTime is invalid, using a default"); - // 10 mins - tcpcheckInterval = 10000 * 60; // 5 minutes + System.out.println("The value for UDPUpdateTime is invalid, using a default"); + // 10 mins + tcpcheckInterval = 10000 * 60; // 5 minutes } // the current time.. @@ -65,41 +65,41 @@ class JavaHost { // keep going for ever and ever ;) if ( nextTCP < nextUDP ){ - try { - long sleeptime = nextTCP - currentTime; - if ( sleeptime > 0 ){ - Thread.sleep(sleeptime); - } - nextTCP += tcpcheckInterval; - // send a heartbeat - //System.out.println("Sending Heartbeat"); + try { + long sleeptime = nextTCP - currentTime; + if ( sleeptime > 0 ){ + Thread.sleep(sleeptime); + } + nextTCP += tcpcheckInterval; + // send a heartbeat + //System.out.println("Sending Heartbeat"); System.out.print("+"); - config.sendHeartBeat(); - if ( config.reloadConfig() ){ - System.out.println("\nRestarting System"); - break; - } - } - catch ( InterruptedException e ){ - // do nothing - } + config.sendHeartBeat(); + if ( config.reloadConfig() ){ + System.out.println("\nRestarting System"); + break; + } + } + catch ( InterruptedException e ){ + // do nothing + } } else { - try { - long sleeptime = nextUDP - currentTime; - if ( sleeptime > 0 ){ - Thread.sleep(sleeptime); - } - nextUDP += udpcheckInterval; - // send a heartbeat - //System.out.println("Sending UDP Packet"); - System.out.print("."); - LowLevelNet.sendUDPPacket(config, sysMon.getInfo()); + try { + long sleeptime = nextUDP - currentTime; + if ( sleeptime > 0 ){ + Thread.sleep(sleeptime); + } + nextUDP += udpcheckInterval; + // send a heartbeat + //System.out.println("Sending UDP Packet"); + System.out.print("."); + LowLevelNet.sendUDPPacket(config, sysMon.getInfo()); - } - catch ( InterruptedException e ){ - // do nothing - } + } + catch ( InterruptedException e ){ + // do nothing + } }