You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ri...@apache.org on 2008/09/02 16:28:53 UTC

svn commit: r691262 - /incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/Main.java

Author: ritchiem
Date: Tue Sep  2 07:28:52 2008
New Revision: 691262

URL: http://svn.apache.org/viewvc?rev=691262&view=rev
Log:
QPID-579 : Make broker stop on startup errors

Modified:
    incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/Main.java

Modified: incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/Main.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/Main.java?rev=691262&r1=691261&r2=691262&view=diff
==============================================================================
--- incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/Main.java (original)
+++ incubator/qpid/trunk/qpid/java/broker/src/main/java/org/apache/qpid/server/Main.java Tue Sep  2 07:28:52 2008
@@ -198,23 +198,31 @@
             {
                 System.out.println(e.getMessage());
                 _brokerLogger.error("Initialisation Error : " + e.getMessage());
-
+                shutdown(1);
             }
             catch (ConfigurationException e)
             {
                 System.out.println("Error configuring message broker: " + e);
                 _brokerLogger.error("Error configuring message broker: " + e);
                 e.printStackTrace();
+                shutdown(1);
             }
-            catch (Exception e)
+            catch (Throwable e)
             {
-                System.out.println("Error intialising message broker: " + e);
-                _brokerLogger.error("Error intialising message broker: " + e);
+                System.out.println("Error initialising message broker: " + e);
+                _brokerLogger.error("Error initialising message broker: " + e);
                 e.printStackTrace();
+                shutdown(1);
             }
         }
     }
 
+    protected void shutdown(int status)
+    {
+        ApplicationRegistry.removeAll();
+        System.exit(status);
+    }
+
     protected void startup() throws InitException, ConfigurationException, Exception
     {
         final String QpidHome = System.getProperty(QPID_HOME);