You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by ri...@apache.org on 2008/11/20 23:16:46 UTC

svn commit: r719404 - /felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java

Author: rickhall
Date: Thu Nov 20 14:16:46 2008
New Revision: 719404

URL: http://svn.apache.org/viewvc?rev=719404&view=rev
Log:
Patch to address a bug during shutdown where uninstalled fragments are not
properly closed, since the fragment and it host both have the fragment's
content open. Modified the purge during shutdown to happen after all bundles
are remove/closed, instead of before. (FELIX-819)

Modified:
    felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java?rev=719404&r1=719403&r2=719404&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java (original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/Felix.java Thu Nov 20 14:16:46 2008
@@ -3838,13 +3838,37 @@
                 // Should never happen.
             }
 
+            // Shutdown event dispatching queue.
+            EventDispatcher.shutdown();
+
+            // Remove all bundles from the module factory so that any
+            // open resources will be closed.
+            Bundle[] bundles = getBundles();
+            for (int i = 0; i < bundles.length; i++)
+            {
+                FelixBundle bundle = (FelixBundle) bundles[i];
+                IModule[] modules = bundle.getInfo().getModules();
+                for (int j = 0; j < modules.length; j++)
+                {
+                    try
+                    {
+                        m_factory.removeModule(modules[j]);
+                    }
+                    catch (Exception ex)
+                    {
+                        m_logger.log(Logger.LOG_ERROR,
+                           "Unable to clean up " + bundle.getInfo().getLocation(), ex);
+                    }
+                }
+            }
+
             // Since there may be updated and uninstalled bundles that
             // have not been refreshed, we will take care of refreshing
             // them during shutdown.
 
             // First loop through all bundled and purge old revisions
             // from updated bundles.
-            Bundle[] bundles = getBundles();
+            bundles = getBundles();
             for (int i = 0; i < bundles.length; i++)
             {
                 FelixBundle bundle = (FelixBundle) bundles[i];
@@ -3883,30 +3907,6 @@
                 }
             }
 
-            // Shutdown event dispatching queue.
-            EventDispatcher.shutdown();
-
-            // Remove all bundles from the module factory so that any
-            // open resources will be closed.
-            bundles = getBundles();
-            for (int i = 0; i < bundles.length; i++)
-            {
-                FelixBundle bundle = (FelixBundle) bundles[i];
-                IModule[] modules = bundle.getInfo().getModules();
-                for (int j = 0; j < modules.length; j++)
-                {
-                    try
-                    {
-                        m_factory.removeModule(modules[j]);
-                    }
-                    catch (Exception ex)
-                    {
-                        m_logger.log(Logger.LOG_ERROR,
-                           "Unable to clean up " + bundle.getInfo().getLocation(), ex);
-                    }
-                }
-            }
-
             // Next, stop all system bundle activators.
             for (int i = 0; i < m_activatorList.size(); i++)
             {