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/monitors/CPU__Monitor.java
(Generate patch)

Comparing projects/cms/source/server/uk/org/iscream/cms/server/client/monitors/CPU__Monitor.java (file contents):
Revision 1.17 by ajm, Tue Mar 6 23:44:08 2001 UTC vs.
Revision 1.18 by ajm, Fri Mar 9 03:30:55 2001 UTC

# Line 35 | Line 35 | public class CPU__Monitor extends MonitorSkeleton {
35          if (packet.getParam("packet.attributes.type").equals("data")) {
36              String source = packet.getParam("packet.attributes.machine_name");
37              if (!_hosts.containsKey(source)) {
38 <                _hosts.put(source, new Register(source, _name, _attributes.length));
38 >                HashMap attributeRegisters = new HashMap();
39 >                initAttributeRegsiters(source, attributeRegisters);
40 >                _hosts.put(source, attributeRegisters);
41              }
42 <            
43 <            Register reg = (Register) _hosts.get(source);
42 >
43 >            HashMap attributeRegisters = (HashMap) _hosts.get(source);
44              for(int attributeNum = 0; attributeNum < _attributes.length; attributeNum++) {
45 +                Register reg = (Register) attributeRegisters.get(_attributes[attributeNum]);
46                  // find out the threshold level we're at
47                  String attribute = _attributes[attributeNum];
48                  String attributeName = _attributeNames[attributeNum];
49                  String currentValue = packet.getParam(attribute);
50                  int newThreshold = checkAttributeThreshold(currentValue, reg);
51 <                processAlert(newThreshold, attributeNum, attributeName, reg, source, currentValue);
51 >                processAlert(newThreshold, attributeName, reg, source, currentValue);
52              }
53          }
54      }
# Line 90 | Line 93 | public class CPU__Monitor extends MonitorSkeleton {
93              }
94          }
95          return Alert.thresholdNORMAL;
96 +    }
97 +
98 +    private void initAttributeRegsiters(String source, HashMap attributeRegisters) {
99 +        for(int attributeNum = 0; attributeNum < _attributes.length; attributeNum++) {
100 +            attributeRegisters.put(_attributes[attributeNum], new Register(source, _name));
101 +        }
102      }
103  
104   //---ACCESSOR/MUTATOR METHODS---

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines