--- projects/cms/source/host/java/SystemMonitor.java 2000/11/30 04:11:00 1.3 +++ projects/cms/source/host/java/SystemMonitor.java 2000/11/30 17:33:36 1.4 @@ -11,7 +11,7 @@ import java.util.Random; * the timeout has passed. * * @author $Author: ab11 $ - * @version $Id: SystemMonitor.java,v 1.3 2000/11/30 04:11:00 ab11 Exp $ + * @version $Id: SystemMonitor.java,v 1.4 2000/11/30 17:33:36 ab11 Exp $ */ class SystemMonitor { @@ -36,7 +36,14 @@ class SystemMonitor { // why oh why wont ultra edit let me put Long in the next line? oh its trying to // correct keywords =| - checkInterval = Long.parseLong(config.getProperty("UDPUpdateTime")) * 1000; + 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 } @@ -71,7 +78,14 @@ class SystemMonitor { } // MUST FIX THIS..!!!! try { - Thread.sleep(( lastCheck + checkInterval )-System.currentTimeMillis()); + long updateIn = ( lastCheck + udpcheckInterval )-System.currentTimeMillis(); + if ( updateIn > 0 ){ + Thread.sleep(updateIn); + } + else + { + Thread.sleep(defaultUpdateTime); + } } catch( InterruptedException e ){ System.out.println("Sleep interrupted"); @@ -93,7 +107,8 @@ class SystemMonitor { private long lastCheck; private int sequence; - private long checkInterval; + private long udpcheckInterval; + private final long defaultUpdateTime = 60000; //---STATIC ATTRIBUTES---