--- projects/cms/source/host/java/SystemMonitor.java 2001/01/19 00:13:49 1.8 +++ projects/cms/source/host/java/SystemMonitor.java 2001/03/19 17:30:17 1.9 @@ -8,12 +8,12 @@ import java.util.*; /** * Gathers system information then outputs it as XML - * Collects data based on properties gained from the configurator - * then packages these up using XMLFormatter and outputs them if - * the timeout has passed. + * Collects data based on properties gained from the + * configurator then packages these up using XMLFormatter + * and outputs them if the timeout has passed. * - * @author $Author: tdb $ - * @version $Id: SystemMonitor.java,v 1.8 2001/01/19 00:13:49 tdb Exp $ + * @author $Author: ab11 $ + * @version $Id: SystemMonitor.java,v 1.9 2001/03/19 17:30:17 ab11 Exp $ */ class SystemMonitor { @@ -24,8 +24,8 @@ class SystemMonitor { //---CONSTRUCTORS--- /** - * Public constructor for the class. Takes in a Config object to gain its - * properties from. + * Public constructor for the class. Takes in a Config + * object to gain its properties from. * */ public SystemMonitor( Config config ){ @@ -34,24 +34,7 @@ class SystemMonitor { lastCheck = System.currentTimeMillis(); sequence = 1; - - - // why oh why wont ultra edit let me put Long in the next line? oh its trying to - // correct keywords =| - /* - try { - udpcheckInterval = Long.parseLong(config.getProperty("UDPUpdateTime")) * 1000; - } - catch ( NumberFormatException e ){ - System.out.println("The value for UDPUpdateTime is invalid, using a default"); - // 5 mins - udpcheckInterval = 5000 * 60; - } - */ - - // make the check interval into seconds - } //---PUBLIC METHODS--- @@ -67,36 +50,18 @@ class SystemMonitor { String ip = new String(); try { host = InetAddress.getLocalHost().getHostName(); - ip = InetAddress.getLocalHost().getHostAddress(); + ip = InetAddress.getLocalHost().getHostAddress(); } catch(UnknownHostException e) { System.out.println(e); } - String date = Long.toString(System.currentTimeMillis()); + String date = Long.toString(System.currentTimeMillis()); XMLFormatter xml = new XMLFormatter("packet", "machine_name=\""+host+"\" ip=\""+ip+"\" date=\""+date+"\" seq_no=\""+sequence+"\" type=\"data\""); - // get and decode the data - DecodeCPU_TXT details = new DecodeCPU_TXT(); + // get and decode the data + DecodeCPU_TXT details = new DecodeCPU_TXT(); // add the decoded info xml.addString(details.getItems()); - - - /* - // MUST FIX THIS..!!!! - try { - long updateIn = ( lastCheck + udpcheckInterval )-System.currentTimeMillis(); - if ( updateIn > 0 ){ - Thread.sleep(updateIn); - } - else - { - Thread.sleep(defaultUpdateTime); - } - } - catch( InterruptedException e ){ - System.out.println("Sleep interrupted"); - } - */ // increment sequence. sequence++; @@ -117,4 +82,4 @@ class SystemMonitor { //---STATIC ATTRIBUTES--- -} // class \ No newline at end of file +} // class