ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/server/uk/org/iscream/cms/server/client/Register.java
(Generate patch)

Comparing projects/cms/source/server/uk/org/iscream/cms/server/client/Register.java (file contents):
Revision 1.3 by ajm, Sun Mar 4 05:23:41 2001 UTC vs.
Revision 1.4 by tdb, Mon Mar 5 23:14:53 2001 UTC

# Line 3 | Line 3 | package uk.ac.ukc.iscream.client;
3  
4   //---IMPORTS---
5   import uk.ac.ukc.iscream.util.*;
6 < import uk.ac.ukc.iscream.componentmanager.ConfigurationProxy;
6 > import uk.ac.ukc.iscream.componentmanager.*;
7  
8   /**
9   * The Register class holds theshold values,
# Line 146 | Line 146 | public class Register {
146       * @param level the alert level
147       */
148      public double getThreshold(int level) {
149 +        // -1.0 means we don't use an alert level
150          double threshold = -1.0;
151 <        String thresholdString = _cp.getProperty("Host." + _hostname, "Monitor." + _monitorName + ".threshold." + Alert.thresholdLevels[level]);
152 <        if(thresholdString != null) {
153 <            try {
154 <                threshold = Double.parseDouble(thresholdString);
155 <            } catch (NumberFormatException e) {
156 <                // -1.0 means we don't use an alert level
157 <                threshold = -1.0;
157 <            }
151 >        try {
152 >            String thresholdString = _cp.getProperty("Host." + _hostname, "Monitor." + _monitorName + ".threshold." + Alert.thresholdLevels[level]);
153 >            threshold = Double.parseDouble(thresholdString);
154 >        } catch (PropertyNotFoundException e) {
155 >            threshold = -1.0;
156 >        } catch (NumberFormatException e) {
157 >            threshold = -1.0;
158          }
159          return threshold;
160      }
# Line 171 | Line 171 | public class Register {
171       * progress faster should a higher threshold value be passed
172       *
173       * If there is no alert timeout for a
174 <     * given level, this returns -1.0
174 >     * given level, this returns 0
175       *
176       * @param level the alert level
177       * @param thresholdLevel the threshold leve we are on
178       */
179      public long getAlertTimeout(int level, int attributeNum) {
180 +        // 0 means we don't use this value
181          long timeout = 0;
182 <        String timeoutString = _cp.getProperty("Host." + _hostname, "Monitor." + _monitorName + ".alertTimeout." + Alert.alertLevels[level]);
183 <        if(timeoutString != null) {
184 <            try {
185 <                int threshold = getLastThresholdLevel(attributeNum);
186 <                if (threshold > 0) {
186 <                    timeout = (Long.parseLong(timeoutString) / threshold) * 1000;
187 <                }
188 <            } catch (NumberFormatException e) {
189 <                // -1.0 means we don't use this value
190 <                timeout = 0;
182 >        try {
183 >            String timeoutString = _cp.getProperty("Host." + _hostname, "Monitor." + _monitorName + ".alertTimeout." + Alert.alertLevels[level]);
184 >            int threshold = getLastThresholdLevel(attributeNum);
185 >            if (threshold > 0) {
186 >                timeout = (Long.parseLong(timeoutString) / threshold) * 1000;
187              }
188 +        } catch (PropertyNotFoundException e) {
189 +            timeout = 0;
190 +        } catch (NumberFormatException e) {
191 +            timeout = 0;
192          }
193          return timeout;
194      }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines