[FELIX-4190] The framework should not hold any lock while calling ServiceFactory#unget

This commit should be quite safe as getUsingBundles() and ungetService() are already thread safe, and there's no possibility for the bundle to acquire a new reference to the service because the service has already been unregistered

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1509692 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/main/java/org/apache/felix/framework/ServiceRegistry.java b/framework/src/main/java/org/apache/felix/framework/ServiceRegistry.java
index 52e2c92..83bdcff 100644
--- a/framework/src/main/java/org/apache/felix/framework/ServiceRegistry.java
+++ b/framework/src/main/java/org/apache/felix/framework/ServiceRegistry.java
@@ -153,16 +153,13 @@
         }
 
         // Now forcibly unget the service object for all stubborn clients.
-        synchronized (this)
+        Bundle[] clients = getUsingBundles(reg.getReference());
+        for (int i = 0; (clients != null) && (i < clients.length); i++)
         {
-            Bundle[] clients = getUsingBundles(reg.getReference());
-            for (int i = 0; (clients != null) && (i < clients.length); i++)
-            {
-                while (ungetService(clients[i], reg.getReference()))
-                    ; // Keep removing until it is no longer possible
-            }
-            ((ServiceRegistrationImpl) reg).invalidate();
+            while (ungetService(clients[i], reg.getReference()))
+                ; // Keep removing until it is no longer possible
         }
+        ((ServiceRegistrationImpl) reg).invalidate();
     }
 
     /**