Author: davidb
Date: Tue Apr 28 13:45:08 2015
New Revision: 1676534

URL: http://svn.apache.org/r1676534
Log:
FELIX-4867 Additional change to improve synchronization as suggested by Richard 
Hall

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=1676534&r1=1676533&r2=1676534&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 
Tue Apr 28 13:45:08 2015
@@ -2674,28 +2674,6 @@ public class Felix extends BundleImpl im
 
     void uninstallBundle(BundleImpl bundle) throws BundleException
     {
-        // Populate a set of refresh candidates. This also includes any 
bundles that this bundle
-        // is wired to but have previously been uninstalled.
-        List<Bundle> refreshCandidates = new ArrayList<Bundle>();
-        refreshCandidates.add(bundle); // Add this bundle first, so that it 
gets refreshed first later on
-        BundleRevisions bundleRevisions = bundle.adapt(BundleRevisions.class);
-        if (bundleRevisions != null)
-        {
-            for (BundleRevision br : bundleRevisions.getRevisions())
-            {
-                BundleWiring bw = br.getWiring();
-                if (bw != null)
-                {
-                    for (BundleWire wire : bw.getRequiredWires(null))
-                    {
-                        Bundle b = wire.getProvider().getBundle();
-                        if (Bundle.UNINSTALLED == b.getState() && 
!refreshCandidates.contains(b))
-                            refreshCandidates.add(b);
-                    }
-                }
-            }
-        }
-
         // Acquire bundle lock.
         try
         {
@@ -2799,6 +2777,28 @@ public class Felix extends BundleImpl im
         boolean locked = acquireGlobalLock();
         if (locked)
         {
+            // Populate a set of refresh candidates. This also includes any 
bundles that this bundle
+            // is wired to but have previously been uninstalled.
+            List<Bundle> refreshCandidates = new ArrayList<Bundle>();
+            refreshCandidates.add(bundle); // Add this bundle first, so that 
it gets refreshed first
+            BundleRevisions bundleRevisions = 
bundle.adapt(BundleRevisions.class);
+            if (bundleRevisions != null)
+            {
+                for (BundleRevision br : bundleRevisions.getRevisions())
+                {
+                    BundleWiring bw = br.getWiring();
+                    if (bw != null)
+                    {
+                        for (BundleWire wire : bw.getRequiredWires(null))
+                        {
+                            Bundle b = wire.getProvider().getBundle();
+                            if (Bundle.UNINSTALLED == b.getState() && 
!refreshCandidates.contains(b))
+                                refreshCandidates.add(b);
+                        }
+                    }
+                }
+            }
+
             try
             {
                 for (Bundle b : refreshCandidates)


Reply via email to