Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
Sometimes, the service about to be unbound needs to be retrieved from the ComponentContext if the unbind method takes the ServiceReference instead of the service object itself. In these cases, the service fails to be returned because the AbstractComponentManager.getDependencyManager(String) only returns DependencyManager instances whose size is not zero.
This now constitutes a race condition, as the service count has already been decremented in the DependencyManager when the unbind method is called. The service itself, though, is actually still available.
The fix is to always return any available DependencyManager regardless of the perceived size. The DependencyManager will then return the service or not dependending on whether the service is still available.