Do not fire REGISTERED event while holding bundle lock. (FELIX-3000)
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1162258 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 55d3b49..61f1e0c 100644
--- a/framework/src/main/java/org/apache/felix/framework/Felix.java
+++ b/framework/src/main/java/org/apache/felix/framework/Felix.java
@@ -3363,12 +3363,8 @@
}
}
- // TODO: CONCURRENCY - Reconsider firing event here, outside of the
- // bundle lock.
-
- // NOTE: The service registered event is fired from the service
- // registry to the framework, where it is then redistributed to
- // interested service event listeners.
+ // Fire service event.
+ fireServiceEvent(new ServiceEvent(ServiceEvent.REGISTERED, reg.getReference()), null);
return reg;
}
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 1206cc8..c21ba5b 100644
--- a/framework/src/main/java/org/apache/felix/framework/ServiceRegistry.java
+++ b/framework/src/main/java/org/apache/felix/framework/ServiceRegistry.java
@@ -99,6 +99,7 @@
return null;
}
+ // Caller is expected to fire REGISTERED event.
public ServiceRegistration registerService(
Bundle bundle, String[] classNames, Object svcObj, Dictionary dict)
{
@@ -119,12 +120,6 @@
m_regCapSet.addCapability((BundleCapabilityImpl) reg.getReference());
}
- // Notify callback objects about registered service.
- if (m_callbacks != null)
- {
- m_callbacks.serviceChanged(
- new ServiceEvent(ServiceEvent.REGISTERED, reg.getReference()), null);
- }
return reg;
}