You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jd...@apache.org on 2008/10/21 17:09:14 UTC

svn commit: r706652 - /geronimo/gshell/trunk/gshell-bootstrap/src/main/java/org/apache/geronimo/gshell/bootstrap/Launcher.java

Author: jdillon
Date: Tue Oct 21 08:09:13 2008
New Revision: 706652

URL: http://svn.apache.org/viewvc?rev=706652&view=rev
Log:
Allow System.exit() to be skipped (for perf tests)

Modified:
    geronimo/gshell/trunk/gshell-bootstrap/src/main/java/org/apache/geronimo/gshell/bootstrap/Launcher.java

Modified: geronimo/gshell/trunk/gshell-bootstrap/src/main/java/org/apache/geronimo/gshell/bootstrap/Launcher.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-bootstrap/src/main/java/org/apache/geronimo/gshell/bootstrap/Launcher.java?rev=706652&r1=706651&r2=706652&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-bootstrap/src/main/java/org/apache/geronimo/gshell/bootstrap/Launcher.java (original)
+++ geronimo/gshell/trunk/gshell-bootstrap/src/main/java/org/apache/geronimo/gshell/bootstrap/Launcher.java Tue Oct 21 08:09:13 2008
@@ -38,36 +38,43 @@
     public static void main(final String[] args) {
         assert args != null;
 
-        Configuration config = new Configuration();
-
         try {
-            Log.debug("Configuring");
-            
-            config.configure();
-
-            ClassLoader cl = config.getClassLoader();
-            Class type = cl.loadClass(MAIN_CLASS);
-            Method method = getMainMethod(type);
-
-            Thread.currentThread().setContextClassLoader(cl);
-
-            if (Log.DEBUG) {
-                Log.debug("Launching: " + method);
-            }
-
-            method.invoke(null, new Object[] { args });
+            launch(args);
 
             Log.debug("Exiting");
 
             System.exit(SUCCESS_EXIT_CODE);
         }
         catch (Throwable t) {
+            Log.debug("Failure: " + t);
+            
             t.printStackTrace(System.err);
             System.err.flush();
             System.exit(FAILURE_EXIT_CODE);
         }
     }
 
+    public static void launch(final String[] args) throws Exception {
+        assert args != null;
+
+        Log.debug("Configuring");
+
+        Configuration config = new Configuration();
+        config.configure();
+
+        ClassLoader cl = config.getClassLoader();
+        Class type = cl.loadClass(MAIN_CLASS);
+        Method method = getMainMethod(type);
+
+        Thread.currentThread().setContextClassLoader(cl);
+
+        if (Log.DEBUG) {
+            Log.debug("Launching: " + method);
+        }
+
+        method.invoke(null, new Object[] { args });
+    }
+
     private static Method getMainMethod(final Class type) throws Exception {
         assert type != null;