You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ga...@apache.org on 2011/05/26 18:08:41 UTC
svn commit: r1127978 -
/geronimo/server/trunk/plugins/aries/geronimo-aries/src/main/java/org/apache/geronimo/aries/ApplicationGBean.java
Author: gawor
Date: Thu May 26 16:08:40 2011
New Revision: 1127978
URL: http://svn.apache.org/viewvc?rev=1127978&view=rev
Log:
GERONIMO-5963: Keep bundles around if EBA start failed
Modified:
geronimo/server/trunk/plugins/aries/geronimo-aries/src/main/java/org/apache/geronimo/aries/ApplicationGBean.java
Modified: geronimo/server/trunk/plugins/aries/geronimo-aries/src/main/java/org/apache/geronimo/aries/ApplicationGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/aries/geronimo-aries/src/main/java/org/apache/geronimo/aries/ApplicationGBean.java?rev=1127978&r1=1127977&r2=1127978&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/aries/geronimo-aries/src/main/java/org/apache/geronimo/aries/ApplicationGBean.java (original)
+++ geronimo/server/trunk/plugins/aries/geronimo-aries/src/main/java/org/apache/geronimo/aries/ApplicationGBean.java Thu May 26 16:08:40 2011
@@ -428,19 +428,29 @@ public class ApplicationGBean implements
return type.cast(service);
}
+ private static boolean getFailOnStartError() {
+ String property = System.getProperty("org.apache.geronimo.aries.failApplicationOnStartError", "false");
+ return Boolean.parseBoolean(property);
+ }
+
public void doStart() throws Exception {
- LOG.debug("Starting {}", application.getApplicationMetadata().getApplicationScope());
+ LOG.debug("Starting {} application.", application.getApplicationMetadata().getApplicationScope());
applicationState = ApplicationState.STARTING;
List<Bundle> bundlesWeStarted = new ArrayList<Bundle>();
+ Bundle currentBundle = null;
try {
for (Bundle b : applicationBundles) {
+ currentBundle = b;
if (BundleUtils.canStart(b)) {
+ LOG.debug("Starting {} application bundle.", b);
b.start(Bundle.START_TRANSIENT);
bundlesWeStarted.add(b);
}
}
+ applicationState = ApplicationState.ACTIVE;
+ LOG.debug("Application {} started successfully.", application.getApplicationMetadata().getApplicationScope());
} catch (BundleException be) {
for (Bundle b : bundlesWeStarted) {
try {
@@ -456,13 +466,17 @@ public class ApplicationGBean implements
}
applicationState = ApplicationState.INSTALLED;
- throw be;
- }
- applicationState = ApplicationState.ACTIVE;
+ if (getFailOnStartError()) {
+ throw be;
+ } else {
+ LOG.error("Error starting {} application. Bundle {} failed to start: {}",
+ new Object[] { application.getApplicationMetadata().getApplicationScope(), currentBundle, be });
+ }
+ }
}
public void doStop() {
- LOG.debug("Stopping {}", application.getApplicationMetadata().getApplicationScope());
+ LOG.debug("Stopping {} application.", application.getApplicationMetadata().getApplicationScope());
for (Bundle bundle : applicationBundles) {
try {
@@ -498,7 +512,7 @@ public class ApplicationGBean implements
}
protected void applicationUninstall() {
- LOG.debug("Uninstalling {}", application.getApplicationMetadata().getApplicationScope());
+ LOG.debug("Uninstalling {} application.", application.getApplicationMetadata().getApplicationScope());
try {
installer.getConfigurationManager().unloadConfiguration(configId);