[jboss-cvs] JBossAS SVN: r58572 - trunk/cluster/src/main/org/jboss/ha/jmx

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Sat Nov 18 06:32:29 EST 2006


Author: bstansberry at jboss.com
Date: 2006-11-18 06:32:28 -0500 (Sat, 18 Nov 2006)
New Revision: 58572

Modified:
   trunk/cluster/src/main/org/jboss/ha/jmx/HAServiceMBeanSupport.java
Log:
Can't query JMX for ClusterPartition class; it's a proxy now

Modified: trunk/cluster/src/main/org/jboss/ha/jmx/HAServiceMBeanSupport.java
===================================================================
--- trunk/cluster/src/main/org/jboss/ha/jmx/HAServiceMBeanSupport.java	2006-11-18 11:31:54 UTC (rev 58571)
+++ trunk/cluster/src/main/org/jboss/ha/jmx/HAServiceMBeanSupport.java	2006-11-18 11:32:28 UTC (rev 58572)
@@ -22,6 +22,7 @@
 package org.jboss.ha.jmx;
 
 import java.io.Serializable;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 
@@ -489,21 +490,32 @@
    {
       log.debug("findHAPartitionWithName, name="+name);
       HAPartition result = null;
-      QueryExp classEQ = Query.eq(Query.classattr(),
-               Query.value(ClusterPartition.class.getName()));
+      // Class name match does not work with the AOP proxy :(
+//      QueryExp classEQ = Query.eq(Query.classattr(),
+//               Query.value(ClusterPartition.class.getName()));
+      QueryExp matchName = Query.match(Query.attr("Name"),
+            Query.value("ClusterPartition"));
       QueryExp matchPartitionName = Query.match(Query.attr("PartitionName"),
          Query.value(name));
-      QueryExp exp = Query.and(classEQ, matchPartitionName);
+      QueryExp exp = Query.and(matchName, matchPartitionName);
       Set mbeans = this.getServer().queryMBeans(null, exp);
       if (mbeans != null && mbeans.size() > 0)
       {
-         ObjectInstance inst = (ObjectInstance) (mbeans.iterator().next());
-         ClusterPartitionMBean cp =
-            (ClusterPartitionMBean) MBeanProxyExt.create(
-               ClusterPartitionMBean.class,
-               inst.getObjectName(),
-               this.getServer());
-         result = cp.getHAPartition();
+         for (Iterator iter = mbeans.iterator(); iter.hasNext();)
+         {
+            ObjectInstance inst = (ObjectInstance) iter.next();
+            try
+            {
+               ClusterPartitionMBean cp =
+                  (ClusterPartitionMBean) MBeanProxyExt.create(
+                     ClusterPartitionMBean.class,
+                     inst.getObjectName(),
+                     this.getServer());
+               result = cp.getHAPartition();
+               break;
+            }
+            catch (Exception e) {}
+         }
       }
 
       if( result == null )




More information about the jboss-cvs-commits mailing list