cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r725799 - /cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/jmx/InstrumentationManagerImpl.java
Date Thu, 11 Dec 2008 20:01:26 GMT
Author: dkulp
Date: Thu Dec 11 12:01:26 2008
New Revision: 725799

URL: http://svn.apache.org/viewvc?rev=725799&view=rev
Log:
Add settings to configure which mbean server is used and ability to use the platform mbean
server

Modified:
    cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/jmx/InstrumentationManagerImpl.java

Modified: cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/jmx/InstrumentationManagerImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/jmx/InstrumentationManagerImpl.java?rev=725799&r1=725798&r2=725799&view=diff
==============================================================================
--- cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/jmx/InstrumentationManagerImpl.java
(original)
+++ cxf/trunk/rt/management/src/main/java/org/apache/cxf/management/jmx/InstrumentationManagerImpl.java
Thu Dec 11 12:01:26 2008
@@ -20,6 +20,7 @@
 package org.apache.cxf.management.jmx;
 
 import java.io.IOException;
+import java.lang.management.ManagementFactory;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
@@ -65,6 +66,8 @@
     private Set<ObjectName> busMBeans = new HashSet<ObjectName>();
     private ModelMBeanAssembler assembler;
     private boolean connectFailed;
+    private String mbeanServerName = ManagementConstants.DEFAULT_DOMAIN_NAME;
+    private boolean usePlatformMBeanServer;
     
     public InstrumentationManagerImpl() {
         super();
@@ -80,6 +83,12 @@
         this.bus = bus;
     }
 
+    public void setServerName(String s) {
+        mbeanServerName = s;
+    }
+    public void setUsePlatformMBeanServer(Boolean flag) {
+        usePlatformMBeanServer = flag;
+    }
 
     @PostConstruct     
     public void register() {    
@@ -94,12 +103,18 @@
     
     @PostConstruct     
     public void init() {    
-        if (isEnabled()) {            
-            List servers = MBeanServerFactory.findMBeanServer(ManagementConstants.DEFAULT_DOMAIN_NAME);
-            if (servers.size() <= 1) {
-                mbs = MBeanServerFactory.createMBeanServer(ManagementConstants.DEFAULT_DOMAIN_NAME);
+        if (isEnabled()) {
+            
+            // return platform mbean server if the option is specified.
+            if (usePlatformMBeanServer) {
+                mbs = ManagementFactory.getPlatformMBeanServer();
             } else {
-                mbs = (MBeanServer)servers.get(0);
+                List servers = MBeanServerFactory.findMBeanServer(mbeanServerName);
+                if (servers.size() <= 1) {
+                    mbs = MBeanServerFactory.createMBeanServer(mbeanServerName);
+                } else {
+                    mbs = (MBeanServer)servers.get(0);
+                }
             }
             mcf = MBServerConnectorFactory.getInstance();
             mcf.setMBeanServer(mbs);



Mime
View raw message