Cannot retrieve service to be unbound in unbind method taking ServiceReference
------------------------------------------------------------------------------
Key: FELIX-464
URL: https://issues.apache.org/jira/browse/FELIX-464
Project: Felix
Issue Type: Bug
Components: Declarative Services
Reporter: Felix Meschberger
Assignee: Felix Meschberger
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.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.