You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by no...@apache.org on 2011/10/27 14:09:05 UTC
svn commit: r1189715 - in
/aries/trunk/application/application-runtime-isolated/src/main/java/org/apache/aries/application/runtime/isolated/impl:
ApplicationContextImpl.java ApplicationContextManagerImpl.java
Author: not
Date: Thu Oct 27 12:09:05 2011
New Revision: 1189715
URL: http://svn.apache.org/viewvc?rev=1189715&view=rev
Log:
ARIES-768 We shouldn't uninstall an application that is already uninstalled
Modified:
aries/trunk/application/application-runtime-isolated/src/main/java/org/apache/aries/application/runtime/isolated/impl/ApplicationContextImpl.java
aries/trunk/application/application-runtime-isolated/src/main/java/org/apache/aries/application/runtime/isolated/impl/ApplicationContextManagerImpl.java
Modified: aries/trunk/application/application-runtime-isolated/src/main/java/org/apache/aries/application/runtime/isolated/impl/ApplicationContextImpl.java
URL: http://svn.apache.org/viewvc/aries/trunk/application/application-runtime-isolated/src/main/java/org/apache/aries/application/runtime/isolated/impl/ApplicationContextImpl.java?rev=1189715&r1=1189714&r2=1189715&view=diff
==============================================================================
--- aries/trunk/application/application-runtime-isolated/src/main/java/org/apache/aries/application/runtime/isolated/impl/ApplicationContextImpl.java (original)
+++ aries/trunk/application/application-runtime-isolated/src/main/java/org/apache/aries/application/runtime/isolated/impl/ApplicationContextImpl.java Thu Oct 27 12:09:05 2011
@@ -133,29 +133,31 @@ public class ApplicationContextImpl impl
{
LOGGER.debug(LOG_ENTRY, "uninstall");
- // Iterate through all of the bundles that were started when this application was started,
- // and attempt to stop and uninstall each of them.
- for (Iterator<Bundle> bundleIter = _bundles.iterator(); bundleIter.hasNext();) {
- Bundle bundleToRemove = bundleIter.next();
-
- try {
- // If Bundle is active, stop it first.
- if (bundleToRemove.getState() == Bundle.ACTIVE) {
- _bundleFrameworkManager.stopBundle(bundleToRemove);
+ if (_state != ApplicationState.UNINSTALLED) {
+ // Iterate through all of the bundles that were started when this application was started,
+ // and attempt to stop and uninstall each of them.
+ for (Iterator<Bundle> bundleIter = _bundles.iterator(); bundleIter.hasNext();) {
+ Bundle bundleToRemove = bundleIter.next();
+
+ try {
+ // If Bundle is active, stop it first.
+ if (bundleToRemove.getState() == Bundle.ACTIVE) {
+ _bundleFrameworkManager.stopBundle(bundleToRemove);
+ }
+
+ // Delegate the uninstall to the bundleFrameworkManager
+ _bundleFrameworkManager.uninstallBundle(bundleToRemove);
+
+ } catch (BundleException be) {
+ LOGGER.debug(LOG_EXCEPTION, be);
+ throw be;
}
-
- // Delegate the uninstall to the bundleFrameworkManager
- _bundleFrameworkManager.uninstallBundle(bundleToRemove);
-
- } catch (BundleException be) {
- LOGGER.debug(LOG_EXCEPTION, be);
- throw be;
}
+ _bundles.clear();
+
+ _state = ApplicationState.UNINSTALLED;
}
- _bundles.clear();
- _state = ApplicationState.UNINSTALLED;
-
LOGGER.debug(LOG_EXIT, "uninstall");
}
Modified: aries/trunk/application/application-runtime-isolated/src/main/java/org/apache/aries/application/runtime/isolated/impl/ApplicationContextManagerImpl.java
URL: http://svn.apache.org/viewvc/aries/trunk/application/application-runtime-isolated/src/main/java/org/apache/aries/application/runtime/isolated/impl/ApplicationContextManagerImpl.java?rev=1189715&r1=1189714&r2=1189715&view=diff
==============================================================================
--- aries/trunk/application/application-runtime-isolated/src/main/java/org/apache/aries/application/runtime/isolated/impl/ApplicationContextManagerImpl.java (original)
+++ aries/trunk/application/application-runtime-isolated/src/main/java/org/apache/aries/application/runtime/isolated/impl/ApplicationContextManagerImpl.java Thu Oct 27 12:09:05 2011
@@ -33,6 +33,7 @@ import java.util.concurrent.ConcurrentMa
import org.apache.aries.application.DeploymentMetadata;
import org.apache.aries.application.management.AriesApplication;
import org.apache.aries.application.management.AriesApplicationContext;
+import org.apache.aries.application.management.AriesApplicationContext.ApplicationState;
import org.apache.aries.application.management.ManagementException;
import org.apache.aries.application.management.UpdateException;
import org.apache.aries.application.management.spi.framework.BundleFrameworkManager;
@@ -156,7 +157,9 @@ public class ApplicationContextManagerIm
{
try {
ApplicationContextImpl ctx = (ApplicationContextImpl)it.next();
- ctx.uninstall();
+ if (ctx.getApplicationState() != ApplicationState.UNINSTALLED) {
+ ctx.uninstall();
+ }
it.remove();
} catch (BundleException e)
{
@@ -191,8 +194,7 @@ public class ApplicationContextManagerIm
public void bindBundleFrameworkManager(BundleFrameworkManager bfm)
{
- LOGGER.debug(LOG_ENTRY, "setBundleFrameworkManager", bfm);
- LOGGER.debug(LOG_EXIT, "setBundleFrameworkManager");
+ LOGGER.debug(LOG_ENTRY, "bindBundleFrameworkManager", bfm);
Iterator<AriesApplicationContext> it = _appToContextMap.values().iterator();
while (it.hasNext())
@@ -205,6 +207,7 @@ public class ApplicationContextManagerIm
LOGGER.debug(LOG_EXCEPTION,e);
}
}
+ LOGGER.debug(LOG_EXIT, "bindBundleFrameworkManager");
}
public void unbindBundleFrameworkManager(BundleFrameworkManager bfm)