commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nico...@apache.org
Subject svn commit: r740661 - /commons/sandbox/monitoring/branches/modules/core/src/main/java/org/apache/commons/monitoring/monitors/NullMonitor.java
Date Wed, 04 Feb 2009 09:13:29 GMT
Author: nicolas
Date: Wed Feb  4 09:13:29 2009
New Revision: 740661

URL: http://svn.apache.org/viewvc?rev=740661&view=rev
Log:
NullMonitor as a stub implemenation accepts any unit

Modified:
    commons/sandbox/monitoring/branches/modules/core/src/main/java/org/apache/commons/monitoring/monitors/NullMonitor.java

Modified: commons/sandbox/monitoring/branches/modules/core/src/main/java/org/apache/commons/monitoring/monitors/NullMonitor.java
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/branches/modules/core/src/main/java/org/apache/commons/monitoring/monitors/NullMonitor.java?rev=740661&r1=740660&r2=740661&view=diff
==============================================================================
--- commons/sandbox/monitoring/branches/modules/core/src/main/java/org/apache/commons/monitoring/monitors/NullMonitor.java
(original)
+++ commons/sandbox/monitoring/branches/modules/core/src/main/java/org/apache/commons/monitoring/monitors/NullMonitor.java
Wed Feb  4 09:13:29 2009
@@ -22,13 +22,22 @@
 public class NullMonitor
     implements Monitor
 {
-    private static Role NOP_COUNTER = new Role( "Nop", Unit.UNARY, Metric.Type.COUNTER );
+    private static final Unit NULL = new Unit( "null" )
+    {
+        @Override
+        public boolean isCompatible( Unit unit )
+        {
+            return true;
+        }
+    };
+
+    private static final Role NOP_COUNTER = new Role( "Nop", NULL, Metric.Type.COUNTER );
 
-    private static Role NOP_GAUGE = new Role( "Nop", Unit.UNARY, Metric.Type.GAUGE );
+    private static final Role NOP_GAUGE = new Role( "Nop", NULL, Metric.Type.GAUGE );
 
-    private static NoOpCounter counter = new NoOpCounter( NOP_COUNTER );
+    private static final NoOpCounter counter = new NoOpCounter( NOP_COUNTER );
 
-    private static NoOpGauge gauge = new NoOpGauge( NOP_GAUGE );
+    private static final NoOpGauge gauge = new NoOpGauge( NOP_GAUGE );
 
     private Collection<Metric> metrics = Arrays.asList( new Metric[] { counter, gauge
} );
 
@@ -82,4 +91,17 @@
         // NoOp
     }
 
+    private static class NullUnit extends Unit
+    {
+        public NullUnit()
+        {
+            super( "null" );
+        }
+
+        @Override
+        public boolean isCompatible( Unit unit )
+        {
+            return true;
+        }
+    }
 }



Mime
View raw message