cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject [1/6] git commit: Fix a problem with compiled with jetty8, but run with jetty 9
Date Thu, 07 Aug 2014 20:58:23 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 470bdcb40 -> ea778c4f3


Fix a problem with compiled with jetty8, but run with jetty 9


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/f2f6aa01
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/f2f6aa01
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/f2f6aa01

Branch: refs/heads/master
Commit: f2f6aa016cdd1bb49698b319806a8369f149c8dd
Parents: 470bdcb
Author: Daniel Kulp <dkulp@apache.org>
Authored: Thu Aug 7 14:55:55 2014 -0400
Committer: Daniel Kulp <dkulp@apache.org>
Committed: Thu Aug 7 14:55:55 2014 -0400

----------------------------------------------------------------------
 .../http_jetty/JettyHTTPServerEngine.java       | 32 ++++++++++++--------
 1 file changed, 19 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/f2f6aa01/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
----------------------------------------------------------------------
diff --git a/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
b/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
index 7057fd6..853b7d4 100644
--- a/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
+++ b/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
@@ -333,14 +333,9 @@ public class JettyHTTPServerEngine
             DefaultHandler defaultHandler = null;
             // create a new jetty server instance if there is no server there           

             server = new Server();
-            
-            if (mBeanContainer != null) {
-                getContainer(server).addEventListener(mBeanContainer);
-                if (!Server.getVersion().startsWith("8")) {
-                    addServerMBean();
-                }
-            }
-                        
+
+            addServerMBean();
+                                    
             if (connector == null) {
                 connector = createConnector(getHost(), getPort());
                 if (LOG.isLoggable(Level.FINER)) {
@@ -481,7 +476,16 @@ public class JettyHTTPServerEngine
     }
     
     private void addServerMBean() {
+        if (mBeanContainer == null) {
+            return;
+        }        
+        
         try {
+            Object o = getContainer(server);
+            o.getClass().getMethod("addEventListener", Container.Listener.class).invoke(o,
mBeanContainer);
+            if (Server.getVersion().startsWith("8")) {
+                return;
+            }
             mBeanContainer.getClass().getMethod("beanAdded", Container.class, Object.class)
                 .invoke(mBeanContainer, null, server);
         } catch (RuntimeException rex) {
@@ -919,11 +923,13 @@ public class JettyHTTPServerEngine
         registedPaths.clear();
         if (server != null) {
             try {
-                connector.stop();
-                if (connector instanceof Closeable) {
-                    ((Closeable)connector).close();
-                } else {
-                    connector.getClass().getMethod("close").invoke(connector);
+                if (connector != null) {
+                    connector.stop();
+                    if (connector instanceof Closeable) {
+                        ((Closeable)connector).close();
+                    } else {
+                        connector.getClass().getMethod("close").invoke(connector);
+                    }
                 }
             } finally {  
                 if (contexts != null) {


Mime
View raw message