cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r835576 - /cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
Date Thu, 12 Nov 2009 21:59:59 GMT
Author: dkulp
Date: Thu Nov 12 21:59:59 2009
New Revision: 835576

URL: http://svn.apache.org/viewvc?rev=835576&view=rev
Log:
Possibly wire in the jetty management if mgmt is enabled

Modified:
    cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java

Modified: cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java?rev=835576&r1=835575&r2=835576&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
(original)
+++ cxf/trunk/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
Thu Nov 12 21:59:59 2009
@@ -29,15 +29,19 @@
 
 import javax.annotation.PostConstruct;
 import javax.annotation.Resource;
+import javax.management.MBeanServer;
 import javax.servlet.ServletContext;
 
 import org.apache.cxf.Bus;
+import org.apache.cxf.common.classloader.ClassLoaderUtils;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.configuration.jsse.TLSServerParameters;
 import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.management.InstrumentationManager;
 import org.apache.cxf.transport.HttpUriMapper;
 import org.apache.cxf.transport.https_jetty.JettySslConnectorFactory;
+import org.mortbay.component.Container;
 import org.mortbay.jetty.AbstractConnector;
 import org.mortbay.jetty.Connector;
 import org.mortbay.jetty.Handler;
@@ -297,6 +301,21 @@
             DefaultHandler defaultHandler = null;
             // create a new jetty server instance if there is no server there           

             server = new Server();
+            if (bus != null && bus.getExtension(InstrumentationManager.class) !=
null) {
+                MBeanServer mbs =  bus.getExtension(InstrumentationManager.class).getMBeanServer();
+                if (mbs != null) {
+                    try {
+                        Class<?> cls = ClassLoaderUtils.loadClass("org.mortbay.management.MBeanContainer",

+                                                              getClass());
+                        Container.Listener listener 
+                            = (Container.Listener)cls.getConstructor(MBeanServer.class).newInstance(mbs);
+                        server.getContainer().addEventListener(listener);
+                    } catch (Throwable ex) {
+                        //ignore - just won't instrument jetty.  Probably don't have the
+                        //jetty-management jar available
+                    }
+                }
+            }
             if (connector == null) {
                 connector = connectorFactory.createConnector(getHost(), getPort());
                 if (LOG.isLoggable(Level.FINER)) {



Mime
View raw message