felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pa...@apache.org
Subject svn commit: r704246 - in /felix/trunk/framework/src/main/java/org/apache/felix/framework: cache/BundleCache.java searchpolicy/ContentLoaderImpl.java
Date Mon, 13 Oct 2008 21:01:01 GMT
Author: pauls
Date: Mon Oct 13 14:01:00 2008
New Revision: 704246

URL: http://svn.apache.org/viewvc?rev=704246&view=rev
Log:
Null the classloader of a bundle when it's contenloader is closed and call System.gc twice
when we can not delete the bundle revision in the cache. This allows to update and uninstall
bundles with native libs on windows. (FELIX-733)

Modified:
    felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/BundleCache.java
    felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/ContentLoaderImpl.java

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/BundleCache.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/BundleCache.java?rev=704246&r1=704245&r2=704246&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/BundleCache.java
(original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/cache/BundleCache.java
Mon Oct 13 14:01:00 2008
@@ -275,7 +275,23 @@
 
     protected static boolean deleteDirectoryTree(File target)
     {
-        if (!getSecureAction().fileExists(target))
+        if (!deleteDirectoryTreeRecursiv(target))
+        {
+            // We might be talking windows and native libs -- hence,
+            // try to trigger a gc and try again. The hope is that
+            // this releases the classloader that loaded the native
+            // lib and allows us to delete it because it then 
+            // would not be used anymore. 
+            System.gc();
+            System.gc();
+            return deleteDirectoryTreeRecursiv(target);
+        }
+        return true;
+    }
+
+    private static boolean deleteDirectoryTreeRecursiv(File target)
+    {
+    	if (!getSecureAction().fileExists(target))
         {
             return true;
         }
@@ -285,7 +301,7 @@
             File[] files = getSecureAction().listDirectory(target);
             for (int i = 0; i < files.length; i++)
             {
-                deleteDirectoryTree(files[i]);
+                deleteDirectoryTreeRecursiv(files[i]);
             }
         }
 

Modified: felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/ContentLoaderImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/ContentLoaderImpl.java?rev=704246&r1=704245&r2=704246&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/ContentLoaderImpl.java
(original)
+++ felix/trunk/framework/src/main/java/org/apache/felix/framework/searchpolicy/ContentLoaderImpl.java
Mon Oct 13 14:01:00 2008
@@ -70,6 +70,10 @@
         {
             m_fragmentContents[i].close();
         }
+        synchronized (this)
+        {
+            m_classLoader = null;
+        }
     }
 
     public IContent getContent()



Mime
View raw message