Author: rickhall
Date: Fri Feb 20 16:51:49 2009
New Revision: 746293

URL: http://svn.apache.org/viewvc?rev=746293&view=rev
Log:
When updating a bundle, the global lock is now acquired to check if the bundle
can be auto-refreshed. (FELIX-851)

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=746293&r1=746292&r2=746293&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 
Fri Feb 20 16:51:49 2009
@@ -1629,21 +1629,30 @@
 
                 fireBundleEvent(BundleEvent.UPDATED, bundle);
 
-                // If the bundle is not used by anyone, then garbage
-                // collect it now.
-                if (!bundle.isUsed())
+                // Acquire global lock to check if we should auto-refresh.
+                acquireGlobalLock();
+
+                try
                 {
-                    try
+                    if (!bundle.isUsed())
                     {
-                        refreshPackages(new BundleImpl[] { bundle });
-                    }
-                    catch (Exception ex)
-                    {
-                        m_logger.log(
-                            Logger.LOG_ERROR,
-                            "Unable to immediately purge the bundle 
revisions.", ex);
+                        try
+                        {
+                            refreshPackages(new BundleImpl[] { bundle });
+                        }
+                        catch (Exception ex)
+                        {
+                            m_logger.log(
+                                Logger.LOG_ERROR,
+                                "Unable to immediately purge the bundle 
revisions.", ex);
+                        }
                     }
                 }
+                finally
+                {
+                    // Always release the global lock.
+                    releaseGlobalLock();
+                }
             }
 
             // If the old state was active, but the new module is a fragment,


Reply via email to