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 2006/06/20 11:07:24 UTC

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

Author: rickhall
Date: Tue Jun 20 02:07:23 2006
New Revision: 415575

URL: http://svn.apache.org/viewvc?rev=415575&view=rev
Log:
Added a patch to aggressively remove modules from module factory during
framework shutdown to force resources for modules to be cleaned up
immediately, rather than waiting for garbage collection.

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

Modified: incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/Felix.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/Felix.java?rev=415575&r1=415574&r2=415575&view=diff
==============================================================================
--- incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/Felix.java (original)
+++ incubator/felix/trunk/org.apache.felix.framework/src/main/java/org/apache/felix/framework/Felix.java Tue Jun 20 02:07:23 2006
@@ -590,6 +590,27 @@
 
         // The framework is no longer in a usable state.
         m_frameworkStatus = INITIAL_STATUS;
+
+        // 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++)
+        {
+            BundleImpl bundle = (BundleImpl) bundles[i];
+            try
+            {
+                IModule[] modules = bundle.getInfo().getModules();
+                for (int j = 0; j < modules.length; j++)
+                {
+                    m_factory.removeModule(modules[j]);
+                }
+            }
+            catch (Exception ex)
+            {
+                m_logger.log(Logger.LOG_ERROR,
+                   "Unable to clean up " + bundle.getInfo().getLocation(), ex);
+            }
+        }
     }
 
     public int getStatus()