You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sh...@apache.org on 2013/05/29 06:57:37 UTC

svn commit: r1487237 - in /lucene/dev/branches/branch_4x: ./ solr/ solr/CHANGES.txt solr/core/ solr/core/src/java/org/apache/solr/core/JmxMonitoredMap.java solr/core/src/test/org/apache/solr/core/TestJmxIntegration.java

Author: shalin
Date: Wed May 29 04:57:36 2013
New Revision: 1487237

URL: http://svn.apache.org/r1487237
Log:
SOLR-4863: Removed non-existent attribute sourceId from dynamic JMX stats to fix AttributeNotFoundException

Modified:
    lucene/dev/branches/branch_4x/   (props changed)
    lucene/dev/branches/branch_4x/solr/   (props changed)
    lucene/dev/branches/branch_4x/solr/CHANGES.txt   (contents, props changed)
    lucene/dev/branches/branch_4x/solr/core/   (props changed)
    lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/JmxMonitoredMap.java
    lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestJmxIntegration.java

Modified: lucene/dev/branches/branch_4x/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/CHANGES.txt?rev=1487237&r1=1487236&r2=1487237&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/CHANGES.txt (original)
+++ lucene/dev/branches/branch_4x/solr/CHANGES.txt Wed May 29 04:57:36 2013
@@ -89,6 +89,9 @@ Bug Fixes
 
 * SOLR-4867: Admin UI - setting loglevel on root throws RangeError (steffkes)
 
+* SOLR-4863: Removed non-existent attribute sourceId from dynamic JMX stats
+  to fix AttributeNotFoundException (suganuma, hossman via shalin)
+
 Other Changes
 ----------------------
 

Modified: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/JmxMonitoredMap.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/JmxMonitoredMap.java?rev=1487237&r1=1487236&r2=1487237&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/JmxMonitoredMap.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/JmxMonitoredMap.java Wed May 29 04:57:36 2013
@@ -210,7 +210,6 @@ public class JmxMonitoredMap<K, V> exten
       staticStats.add("version");
       staticStats.add("description");
       staticStats.add("category");
-      staticStats.add("sourceId");
       staticStats.add("source");
       this.coreHashCode = coreHashCode;
     }

Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestJmxIntegration.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestJmxIntegration.java?rev=1487237&r1=1487236&r2=1487237&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestJmxIntegration.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/core/TestJmxIntegration.java Wed May 29 04:57:36 2013
@@ -69,15 +69,29 @@ public class TestJmxIntegration extends 
     assertTrue("No MBeans found in server", mbeanServer.getMBeanCount() > 0);
 
     Set<ObjectInstance> objects = mbeanServer.queryMBeans(null, null);
-    assertFalse("No SolrInfoMBean objects found in mbean server", objects
+    assertFalse("No objects found in mbean server", objects
             .isEmpty());
+    int numDynamicMbeans = 0;
     for (ObjectInstance o : objects) {
+      assertNotNull("Null name on: " + o.toString(), o.getObjectName());
       MBeanInfo mbeanInfo = mbeanServer.getMBeanInfo(o.getObjectName());
       if (mbeanInfo.getClassName().endsWith(SolrDynamicMBean.class.getName())) {
-        assertTrue("No Attributes found for mbean: " + mbeanInfo, mbeanInfo
-                .getAttributes().length > 0);
+        numDynamicMbeans++;
+        MBeanAttributeInfo[] attrs = mbeanInfo.getAttributes();
+        assertTrue("No Attributes found for mbean: " + mbeanInfo, 
+                   0 < attrs.length);
+        for (MBeanAttributeInfo attr : attrs) {
+          // ensure every advertised attribute is gettable
+          try {
+            Object trash = mbeanServer.getAttribute(o.getObjectName(), attr.getName());
+          } catch (javax.management.AttributeNotFoundException e) {
+            throw new RuntimeException("Unable to featch attribute for " + o.getObjectName()
+                                       + ": " + attr.getName(), e);
+          }
+        }
       }
     }
+    assertTrue("No SolrDynamicMBeans found", 0 < numDynamicMbeans);
   }
 
   @Test