camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject svn commit: r1446863 - in /camel/branches/camel-2.9.x: ./ camel-core/src/main/java/org/apache/camel/management/ camel-core/src/main/java/org/apache/camel/spi/
Date Sat, 16 Feb 2013 09:37:11 GMT
Author: davsclaus
Date: Sat Feb 16 09:37:10 2013
New Revision: 1446863

URL: http://svn.apache.org/r1446863
Log:
CAMEL-6079: Skip trying to regsiter proxy class as JMX MBeans

Modified:
    camel/branches/camel-2.9.x/   (props changed)
    camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/management/DefaultManagementAgent.java
    camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/management/DefaultManagementMBeanAssembler.java
    camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/management/MBeanInfoAssembler.java
    camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/spi/ManagementMBeanAssembler.java

Propchange: camel/branches/camel-2.9.x/
------------------------------------------------------------------------------
  Merged /camel/trunk:r1446860
  Merged /camel/branches/camel-2.10.x:r1446861

Propchange: camel/branches/camel-2.9.x/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/management/DefaultManagementAgent.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/management/DefaultManagementAgent.java?rev=1446863&r1=1446862&r2=1446863&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/management/DefaultManagementAgent.java
(original)
+++ camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/management/DefaultManagementAgent.java
Sat Feb 16 09:37:10 2013
@@ -229,8 +229,10 @@ public class DefaultManagementAgent exte
             ManagementMBeanAssembler assembler = camelContext.getManagementMBeanAssembler();
             ObjectHelper.notNull(assembler, "ManagementMBeanAssembler", camelContext);
             Object mbean = assembler.assemble(server, obj, name);
-            // and register the mbean
-            registerMBeanWithServer(mbean, name, forceRegistration);
+            if (mbean != null) {
+                // and register the mbean
+                registerMBeanWithServer(mbean, name, forceRegistration);
+            }
         }
     }
 

Modified: camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/management/DefaultManagementMBeanAssembler.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/management/DefaultManagementMBeanAssembler.java?rev=1446863&r1=1446862&r2=1446863&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/management/DefaultManagementMBeanAssembler.java
(original)
+++ camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/management/DefaultManagementMBeanAssembler.java
Sat Feb 16 09:37:10 2013
@@ -69,6 +69,10 @@ public class DefaultManagementMBeanAssem
             mbi = assembler.getMBeanInfo(obj, null, name.toString());
         }
 
+        if (mbi == null) {
+            return null;
+        }
+
         RequiredModelMBean mbean = (RequiredModelMBean) mBeanServer.instantiate(RequiredModelMBean.class.getName());
         mbean.setModelMBeanInfo(mbi);
 
@@ -77,7 +81,7 @@ public class DefaultManagementMBeanAssem
         } catch (InvalidTargetObjectTypeException e) {
             throw new JMException(e.getMessage());
         }
-        
+
         // Allows the managed object to send notifications
         if (obj instanceof NotificationSenderAware) {
             ((NotificationSenderAware)obj).setNotificationSender(new NotificationSenderAdapter(mbean));

Modified: camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/management/MBeanInfoAssembler.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/management/MBeanInfoAssembler.java?rev=1446863&r1=1446862&r2=1446863&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/management/MBeanInfoAssembler.java
(original)
+++ camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/management/MBeanInfoAssembler.java
Sat Feb 16 09:37:10 2013
@@ -18,6 +18,7 @@ package org.apache.camel.management;
 
 import java.lang.reflect.Method;
 import java.util.HashMap;
+import java.lang.reflect.Proxy;
 import java.util.LinkedHashSet;
 import java.util.Map;
 import java.util.Set;
@@ -55,10 +56,16 @@ public class MBeanInfoAssembler {
      * @param defaultManagedBean  the default managed bean
      * @param customManagedBean   an optional custom managed bean
      * @param objectName   the object name
-     * @return the model info
+     * @return the model info, or <tt>null</tt> if not possible to create, for
example due the managed bean is a proxy class
      * @throws JMException is thrown if error creating the model info
      */
     public ModelMBeanInfo getMBeanInfo(Object defaultManagedBean, Object customManagedBean,
String objectName) throws JMException {
+        // skip proxy classes
+        if (Proxy.isProxyClass(defaultManagedBean.getClass())) {
+            LOG.trace("Skip creating ModelMBeanInfo due proxy class {}", defaultManagedBean.getClass());
+            return null;
+        }
+
         // maps and lists to contain information about attributes and operations
         Map<String, ManagedAttributeInfo> attributes = new HashMap<String, ManagedAttributeInfo>();
         Set<ManagedOperationInfo> operations = new LinkedHashSet<ManagedOperationInfo>();

Modified: camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/spi/ManagementMBeanAssembler.java
URL: http://svn.apache.org/viewvc/camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/spi/ManagementMBeanAssembler.java?rev=1446863&r1=1446862&r2=1446863&view=diff
==============================================================================
--- camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/spi/ManagementMBeanAssembler.java
(original)
+++ camel/branches/camel-2.9.x/camel-core/src/main/java/org/apache/camel/spi/ManagementMBeanAssembler.java
Sat Feb 16 09:37:10 2013
@@ -33,7 +33,7 @@ public interface ManagementMBeanAssemble
      * @param mBeanServer the mbean server
      * @param obj         the object
      * @param name        the object name to use in JMX
-     * @return the assembled {@link javax.management.modelmbean.ModelMBean}
+     * @return the assembled {@link javax.management.modelmbean.ModelMBean}, or <tt>null</tt>
if not possible to assemble an MBean
      * @throws JMException is thrown if error assembling the mbean
      */
     ModelMBean assemble(MBeanServer mBeanServer, Object obj, ObjectName name) throws JMException;



Mime
View raw message