You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2006/02/06 13:54:10 UTC

svn commit: r375269 - in /incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http: HttpLifeCycle.java ServerManager.java

Author: gnodet
Date: Mon Feb  6 04:54:07 2006
New Revision: 375269

URL: http://svn.apache.org/viewcvs?rev=375269&view=rev
Log:
Fix problem on shutdown / restart of http component

Modified:
    incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/HttpLifeCycle.java
    incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/ServerManager.java

Modified: incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/HttpLifeCycle.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/HttpLifeCycle.java?rev=375269&r1=375268&r2=375269&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/HttpLifeCycle.java (original)
+++ incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/HttpLifeCycle.java Mon Feb  6 04:54:07 2006
@@ -80,7 +80,9 @@
     protected void doShutDown() throws Exception {
         super.doShutDown();
         if (server != null) {
-            server.shutDown();
+            ServerManager s = server;
+            server = null;
+            s.shutDown();
         }
         if (connectionManager != null) {
             connectionManager.shutdown();

Modified: incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/ServerManager.java
URL: http://svn.apache.org/viewcvs/incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/ServerManager.java?rev=375269&r1=375268&r2=375269&view=diff
==============================================================================
--- incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/ServerManager.java (original)
+++ incubator/servicemix/trunk/servicemix-http/src/main/java/org/apache/servicemix/http/ServerManager.java Mon Feb  6 04:54:07 2006
@@ -21,11 +21,12 @@
 import java.util.Arrays;
 import java.util.List;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.mortbay.jetty.Connector;
 import org.mortbay.jetty.Handler;
 import org.mortbay.jetty.Server;
 import org.mortbay.jetty.handler.ContextHandler;
-import org.mortbay.jetty.nio.SelectChannelConnector;
 import org.mortbay.jetty.servlet.ServletHandler;
 import org.mortbay.jetty.servlet.ServletHolder;
 import org.mortbay.jetty.servlet.ServletMapping;
@@ -33,6 +34,8 @@
 
 public class ServerManager {
 
+    private static final Log logger = LogFactory.getLog(ServerManager.class);
+    
     private Server server;
     private HttpConfiguration configuration;
     
@@ -60,7 +63,6 @@
         server.stop();
     }
     
-    // TODO: handle https
     public synchronized ContextHandler createContext(String strUrl, HttpProcessor processor) throws Exception {
         URL url = new URL(strUrl);
         Connector listener = getListener(url);
@@ -141,9 +143,11 @@
         try {
             listener = (Connector) Class.forName(connectorClassName).newInstance();
         } catch (Exception e) {
-            // TODO use logger
-            e.printStackTrace();
-            listener = new SelectChannelConnector();
+            logger.warn("Could not create a jetty connector of class '" + connectorClassName + "'. Defaulting to " + HttpConfiguration.DEFAULT_JETTY_CONNECTOR_CLASS_NAME);
+            if (logger.isDebugEnabled()) {
+                logger.debug("Reason: " + e.getMessage(), e);
+            }
+            listener = (Connector) Class.forName(HttpConfiguration.DEFAULT_JETTY_CONNECTOR_CLASS_NAME).newInstance();
         }
         listener.setHost(url.getHost());
         listener.setPort(url.getPort());