Author: adrianc
Date: Sat Mar 26 15:08:41 2011
New Revision: 1085733
URL:
http://svn.apache.org/viewvc?rev=1085733&view=revLog:
Fixed a bug from one of my previous commits: In Start.java there could be a thread deadlock if one of the loaders failed to load.
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=1085733&r1=1085732&r2=1085733&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 Sat Mar 26 15:08:41 2011
@@ -269,22 +269,28 @@ public class Start implements Runnable {
}
}
- private void startStartLoaders() {
+ /**
+ * Returns <code>true</code> if all loaders were loaded.
+ *
+ * @return <code>true</code> if all loaders were loaded.
+ */
+ private boolean startStartLoaders() {
synchronized (this.loaders) {
// start the loaders
for (StartupLoader loader: this.loaders) {
if (this.serverStopping) {
- return;
+ return false;
}
try {
loader.start();
} catch (StartupException e) {
e.printStackTrace();
- System.exit(99);
+ return false;
}
}
serverStarted = true;
}
+ return true;
}
private void setShutdownHook() {
@@ -330,7 +336,9 @@ public class Start implements Runnable {
private void startServer() {
// start the startup loaders
- startStartLoaders();
+ if (!startStartLoaders()) {
+ System.exit(99);
+ }
}
public void start() {