You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ta...@apache.org on 2016/06/03 16:31:34 UTC

svn commit: r1746737 - /ofbiz/trunk/framework/start/src/org/ofbiz/base/start/Start.java

Author: taher
Date: Fri Jun  3 16:31:34 2016
New Revision: 1746737

URL: http://svn.apache.org/viewvc?rev=1746737&view=rev
Log:
Fix regression caused by refactoring start comp - ref OFBIZ-7167

Thanks to an excellent investigation by Jacques Le Roux we realized
that if not all tests are successful (on java -jar ofbiz -jar --tests)
then the system hangs and does not print HTML reports.

After investigating this issue, I realized that the old logic before
refactoring used to call System.exit(99) which executes all the shutdown
hooks and releases the system resources. In the new code, however, the
resources are not released as the exception simply bubbles up to the main
method and thrown out, while the other threads are still running. So
the resources are not released and build.xml cannot continue processing
the HTML results with <junitreport ...>

The fix is simple, but the investigation was hard. Big thank you to Jacques.

Modified:
    ofbiz/trunk/framework/start/src/org/ofbiz/base/start/Start.java

Modified: ofbiz/trunk/framework/start/src/org/ofbiz/base/start/Start.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/start/src/org/ofbiz/base/start/Start.java?rev=1746737&r1=1746736&r2=1746737&view=diff
==============================================================================
--- ofbiz/trunk/framework/start/src/org/ofbiz/base/start/Start.java (original)
+++ ofbiz/trunk/framework/start/src/org/ofbiz/base/start/Start.java Fri Jun  3 16:31:34 2016
@@ -81,7 +81,13 @@ public final class Start {
                 System.out.println("Shutting down server : " + StartupControlPanel.shutdown(instance.config));
                 break;
             case START:
-                StartupControlPanel.start(instance.config, instance.serverState, ofbizCommands);
+                try {
+                    StartupControlPanel.start(instance.config, instance.serverState, ofbizCommands);
+                } catch (StartupException e) {
+                    // if startup logic fails, execute shutdown hooks
+                    e.printStackTrace();
+                    System.exit(99);
+                }
                 break;
         }
     }