mx4j/src/core/mx4j/monitor MX4JCounterMonitor.java,1.3,1.4

Jeremy Boynes <[email protected]> Sun, 13 Feb 2005 17:18:00 +0000
Newsgroups gmane.comp.java.mx4j.cvs
Message-ID <[email protected]>
Update of /cvsroot/mx4j/mx4j/src/core/mx4j/monitor
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11990/src/core/mx4j/monitor

Modified Files:
	MX4JCounterMonitor.java 
Log Message:
Fix for [ 1121856 ] CounterMonitor should not notify if already able threshold
Fix for [ 1121854 ] CounterMonitor value can be negative

Index: MX4JCounterMonitor.java
===================================================================
RCS file: /cvsroot/mx4j/mx4j/src/core/mx4j/monitor/MX4JCounterMonitor.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** MX4JCounterMonitor.java	13 Nov 2004 16:38:54 -0000	1.3
--- MX4JCounterMonitor.java	13 Feb 2005 17:17:56 -0000	1.4
***************
*** 155,167 ****
        }
  
-       Number gauge = (Number)value;
- 
-       if (compare(gauge, ZERO) < 0)
-       {
-          // Spec requires counter monitor values not be negative
-          sendErrorNotification(monitorInfo, MonitorNotification.THRESHOLD_ERROR, "Attribute value cannot be negative " + gauge, name, attribute);
-          return;
-       }
- 
        // Spec requires that types of gauge, threshold, offset and modulus be affine
        Number threshold = null;
--- 155,158 ----
***************
*** 174,177 ****
--- 165,169 ----
           modulus = getModulus();
        }
+       Number gauge = (Number)value;
        Class gaugeClass = gauge.getClass();
        if (threshold != ZERO && threshold.getClass() != gaugeClass)
***************
*** 246,255 ****
        Logger logger = getLogger();
  
-       if (info.isThresholdNotified() && compare(gauge, info.getGauge()) == 0)
-       {
-          if (logger.isEnabledFor(Logger.DEBUG)) logger.debug("Threshold exceeded already notified, gauge did not change: " + gauge);
-          return false;
-       }
- 
        if (compare(gauge, threshold) >= 0)
        {
--- 238,241 ----
***************
*** 257,263 ****
           if (getNotify())
           {
!             if (logger.isEnabledFor(Logger.DEBUG)) logger.debug("Sending threshold exceeded notification");
!             info.setThresholdNotified(true);
!             sendNotification(MonitorNotification.THRESHOLD_VALUE_EXCEEDED, "Threshold " + threshold + " exceeded: " + gauge, name, attribute, gauge, threshold);
           }
           else
--- 243,256 ----
           if (getNotify())
           {
!             if (info.isThresholdNotified())
!             {
!                if (logger.isEnabledFor(Logger.DEBUG)) logger.debug("Threshold exceeded already notified: " + gauge);
!             }
!             else
!             {
!                if (logger.isEnabledFor(Logger.DEBUG)) logger.debug("Sending threshold exceeded notification");
!                info.setThresholdNotified(true);
!                sendNotification(MonitorNotification.THRESHOLD_VALUE_EXCEEDED, "Threshold " + threshold + " exceeded: " + gauge, name, attribute, gauge, threshold);
!             }
           }
           else



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click