commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jlmonte...@apache.org
Subject svn commit: r1529186 - in /commons/sandbox/monitoring/trunk: core/src/main/java/org/apache/commons/monitoring/gauges/Gauge.java web/src/main/java/org/apache/commons/monitoring/web/discovery/GaugeDiscoveryListener.java
Date Fri, 04 Oct 2013 15:25:28 GMT
Author: jlmonteiro
Date: Fri Oct  4 15:25:28 2013
New Revision: 1529186

URL: http://svn.apache.org/r1529186
Log:
Fix the Gauge discovery mechanism which is broken when more than one entry

Modified:
    commons/sandbox/monitoring/trunk/core/src/main/java/org/apache/commons/monitoring/gauges/Gauge.java
    commons/sandbox/monitoring/trunk/web/src/main/java/org/apache/commons/monitoring/web/discovery/GaugeDiscoveryListener.java

Modified: commons/sandbox/monitoring/trunk/core/src/main/java/org/apache/commons/monitoring/gauges/Gauge.java
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/core/src/main/java/org/apache/commons/monitoring/gauges/Gauge.java?rev=1529186&r1=1529185&r2=1529186&view=diff
==============================================================================
--- commons/sandbox/monitoring/trunk/core/src/main/java/org/apache/commons/monitoring/gauges/Gauge.java
(original)
+++ commons/sandbox/monitoring/trunk/core/src/main/java/org/apache/commons/monitoring/gauges/Gauge.java
Fri Oct  4 15:25:28 2013
@@ -47,11 +47,14 @@ public interface Gauge {
             final Class<? extends Gauge> gaugeClass = g.getClass();
             if (!excludeParent || gaugeClass.getClassLoader() == classLoader) {
                 if (prefixes != null) {
+                    boolean found = false;
                     for (final String p : prefixes) {
-                        if (!gaugeClass.getName().startsWith(p.trim())) {
-                            return;
+                        if (gaugeClass.getName().startsWith(p.trim())) {
+                            found = true;
+                            break;
                         }
                     }
+                    if (!found) return;
                 }
                 Repository.INSTANCE.addGauge(g);
                 gauges.add(g);

Modified: commons/sandbox/monitoring/trunk/web/src/main/java/org/apache/commons/monitoring/web/discovery/GaugeDiscoveryListener.java
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/web/src/main/java/org/apache/commons/monitoring/web/discovery/GaugeDiscoveryListener.java?rev=1529186&r1=1529185&r2=1529186&view=diff
==============================================================================
--- commons/sandbox/monitoring/trunk/web/src/main/java/org/apache/commons/monitoring/web/discovery/GaugeDiscoveryListener.java
(original)
+++ commons/sandbox/monitoring/trunk/web/src/main/java/org/apache/commons/monitoring/web/discovery/GaugeDiscoveryListener.java
Fri Oct  4 15:25:28 2013
@@ -31,9 +31,9 @@ public class GaugeDiscoveryListener impl
         if (prefixesStr != null) {
             prefixes = prefixesStr.split(",");
         } else {
-            prefixes = new String[0];
+            prefixes = null;
         }
-        helper = new Gauge.LoaderHelper("true".equals(sce.getServletContext().getInitParameter("monitoring.discovery.exclude-parent")),
prefixes);
+        helper = ge.LoaderHelper("true".equals(sce.getServletContext().getInitParameter("monitoring.discovery.exclude-parent")),
prefixes);
     }
 
     @Override



Mime
View raw message