]> source.dussan.org Git - sonarqube.git/commitdiff
Fix handling of error during server startup
authorSimon Brandhof <simon.brandhof@gmail.com>
Mon, 14 Oct 2013 12:01:27 +0000 (14:01 +0200)
committerSimon Brandhof <simon.brandhof@gmail.com>
Mon, 14 Oct 2013 12:02:13 +0000 (14:02 +0200)
Server should stop.

sonar-server/src/main/java/org/sonar/server/platform/PlatformLifecycleListener.java

index 963ee9703537b6bca7dc180d506f1afde2d42b8f..0ae48df97cc3af3ffbe2e0594ddce12b773cb93e 100644 (file)
@@ -40,11 +40,19 @@ public final class PlatformLifecycleListener implements ServletContextListener {
       // - the second listener for jruby on rails is started even if this listener fails. It generates
       // unexpected errors
       LoggerFactory.getLogger(getClass()).error("Fail to start server", t);
-      Platform.getInstance().stop();
+      stopQuietly();
       System.exit(1);
     }
   }
 
+  private void stopQuietly() {
+    try {
+      Platform.getInstance().stop();
+    } catch (Exception e) {
+      // ignored, but an error during startup generally prevents pico to be correctly stopped
+    }
+  }
+
   public void contextDestroyed(ServletContextEvent event) {
     Platform.getInstance().stop();
   }