Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
scr-1.0.8
-
None
Description
Consider a static component references with mulitplie cardinality, that is 0..n or 1..n.
If the component is satisified and active, all services existing at the time of activation are bound. If now a service is registered matching the component's reference this newly registered service must not be bound to the component.
Only if the component is reactivated for another reason (e.g. reconfiguration or removal of a statically bound service) may the newly registered service be bound. This is comparable to optional package imports: such imports are only wired to newly installed bundles when the importing bundle is explicitly rewired.
In other words here is what may happen :
(1) Component C is enabled, satisfied and activated. All services bound. C has static, multiple reference to Service type TS
(2) Service S of type TS is registered
(3) The service is not bound
(4) Component C is deactivated (e.g. for reconfiguration)
(5) Component C is still satisifed and activated. Now Service S is bound
In current versions (1.0.8 and earlier) scr is immediately reactivating the component to bind the new Service S in step 3; which is wrong.
See also the discussion on the OSGi dev list "Questions on DS Spec" [1] for full details.
[1] http://www.mail-archive.com/osgi-dev@mail.osgi.org/msg00883.html