cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1081470 - in /cxf/branches/2.3.x-fixes: ./ rt/management/src/main/java/org/apache/cxf/management/jmx/InstrumentationManagerImpl.java
Date Mon, 14 Mar 2011 17:01:40 GMT
Author: dkulp
Date: Mon Mar 14 17:01:40 2011
New Revision: 1081470

URL: http://svn.apache.org/viewvc?rev=1081470&view=rev
Log:
Merged revisions 1081468 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1081468 | dkulp | 2011-03-14 12:58:21 -0400 (Mon, 14 Mar 2011) | 1 line
  
  Fix compile failure on Java5
........

Modified:
    cxf/branches/2.3.x-fixes/   (props changed)
    cxf/branches/2.3.x-fixes/rt/management/src/main/java/org/apache/cxf/management/jmx/InstrumentationManagerImpl.java

Propchange: cxf/branches/2.3.x-fixes/
            ('svn:mergeinfo' removed)

Propchange: cxf/branches/2.3.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.3.x-fixes/rt/management/src/main/java/org/apache/cxf/management/jmx/InstrumentationManagerImpl.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.3.x-fixes/rt/management/src/main/java/org/apache/cxf/management/jmx/InstrumentationManagerImpl.java?rev=1081470&r1=1081469&r2=1081470&view=diff
==============================================================================
--- cxf/branches/2.3.x-fixes/rt/management/src/main/java/org/apache/cxf/management/jmx/InstrumentationManagerImpl.java
(original)
+++ cxf/branches/2.3.x-fixes/rt/management/src/main/java/org/apache/cxf/management/jmx/InstrumentationManagerImpl.java
Mon Mar 14 17:01:40 2011
@@ -36,6 +36,7 @@ import javax.management.JMException;
 import javax.management.MBeanServer;
 import javax.management.MBeanServerDelegate;
 import javax.management.MBeanServerFactory;
+import javax.management.MalformedObjectNameException;
 
 import javax.management.NotCompliantMBeanException;
 import javax.management.ObjectInstance;
@@ -132,7 +133,7 @@ public class InstrumentationManagerImpl 
                     if (servers == null || servers.size() == 0) {
                         mbs = MBeanServerFactory.createMBeanServer(mbeanServerName);
                         try {
-                            mbeanServerID = (String) mbs.getAttribute(MBeanServerDelegate.DELEGATE_NAME,
+                            mbeanServerID = (String) mbs.getAttribute(getDelegateName(),
                                                                      "MBeanServerId");
                             mbeanServerIDMap.put(mbeanServerName, mbeanServerID);
                         } catch (JMException e) {
@@ -170,6 +171,21 @@ public class InstrumentationManagerImpl 
             }
         }
     }
+    
+    private ObjectName getDelegateName() throws JMException {
+        try {
+            return (ObjectName)MBeanServerDelegate.class.getField("DELEGATE_NAME").get(null);
+        } catch (Throwable t) {
+            //ignore, likely on Java5
+        }
+        try {
+            return new ObjectName("JMImplementation:type=MBeanServerDelegate");
+        } catch (MalformedObjectNameException e) {
+            JMException jme = new JMException(e.getMessage());
+            jme.initCause(e);
+            throw jme;
+        }
+    }
 
     public void register(Object obj, ObjectName name) throws JMException {
         register(obj, name, false);        



Mime
View raw message