Fire event without bundle lock. (FELIX-2035)


git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@943917 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/main/java/org/apache/felix/framework/Felix.java b/framework/src/main/java/org/apache/felix/framework/Felix.java
index 6b123aa..3659b9f 100644
--- a/framework/src/main/java/org/apache/felix/framework/Felix.java
+++ b/framework/src/main/java/org/apache/felix/framework/Felix.java
@@ -4135,9 +4135,9 @@
             BundleImpl bundle = (BundleImpl) module.getBundle();
 
             // Lock the bundle first.
+            boolean fire = false;
             try
             {
-// TODO: RESOLVER - Seems like we should release the lock before we fire the event.
                 // Acquire bundle lock.
                 try
                 {
@@ -4158,7 +4158,7 @@
                     else
                     {
                         setBundleStateAndNotify(bundle, Bundle.RESOLVED);
-                        fireBundleEvent(BundleEvent.RESOLVED, bundle);
+                        fire = true;
                     }
                 }
             }
@@ -4166,6 +4166,12 @@
             {
                 releaseBundleLock(bundle);
             }
+
+            // Fire event while not holding the bundle lock.
+            if (fire)
+            {
+                fireBundleEvent(BundleEvent.RESOLVED, bundle);
+            }
         }
     }