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/28 14:56:40 UTC

svn commit: r1190285 - in /aries/trunk/application/application-runtime-isolated/src/main/java/org/apache/aries/application/runtime/isolated/impl: ApplicationContextImpl.java ApplicationContextManagerImpl.java

Author: not
Date: Fri Oct 28 12:56:40 2011
New Revision: 1190285

URL: http://svn.apache.org/viewvc?rev=1190285&view=rev
Log:
ARIES-768 Make the isolated application context manager more resilient to failure. Also don't try to uninstall bundles that are no longer installed

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=1190285&r1=1190284&r2=1190285&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 Fri Oct 28 12:56:40 2011
@@ -139,21 +139,26 @@ public class ApplicationContextImpl impl
       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 (bundleToRemove.getState() != Bundle.UNINSTALLED) {
+          try {
+            // If Bundle is active, stop it first.
+            if (bundleToRemove.getState() == Bundle.ACTIVE) {
+              _bundleFrameworkManager.stopBundle(bundleToRemove);
+            }
+          } catch (BundleException be) {
+            LOGGER.debug(LOG_EXCEPTION, be);
           }
   
-          // Delegate the uninstall to the bundleFrameworkManager
-          _bundleFrameworkManager.uninstallBundle(bundleToRemove);
-  
-        } catch (BundleException be) {
-          LOGGER.debug(LOG_EXCEPTION, be);
-          throw be;
+          try {
+            // Delegate the uninstall to the bundleFrameworkManager
+            _bundleFrameworkManager.uninstallBundle(bundleToRemove);
+    
+          } catch (BundleException be) {
+            LOGGER.debug(LOG_EXCEPTION, be);
+          }
         }
+        bundleIter.remove();
       }
-      _bundles.clear();
       
       _state = ApplicationState.UNINSTALLED;
     }

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=1190285&r1=1190284&r2=1190285&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 Fri Oct 28 12:56:40 2011
@@ -160,11 +160,11 @@ public class ApplicationContextManagerIm
         if (ctx.getApplicationState() != ApplicationState.UNINSTALLED) {
           ctx.uninstall();
         }
-        it.remove();
       } catch (BundleException e)
       {
         LOGGER.debug(LOG_EXCEPTION,e);
       }
+      it.remove();
     }
     
     LOGGER.debug(LOG_EXIT, "close");
@@ -192,7 +192,7 @@ public class ApplicationContextManagerIm
     return ctx;
   }
 
-  public void bindBundleFrameworkManager(BundleFrameworkManager bfm)
+  public synchronized void bindBundleFrameworkManager(BundleFrameworkManager bfm)
   {
     LOGGER.debug(LOG_ENTRY, "bindBundleFrameworkManager", bfm);
     
@@ -210,7 +210,7 @@ public class ApplicationContextManagerIm
     LOGGER.debug(LOG_EXIT, "bindBundleFrameworkManager");
   }
 
-  public void unbindBundleFrameworkManager(BundleFrameworkManager bfm)
+  public synchronized void unbindBundleFrameworkManager(BundleFrameworkManager bfm)
   {
     LOGGER.debug(LOG_ENTRY, "unbindBundleFrameworkManager", bfm);