[
https://issues.apache.org/jira/browse/FELIX-4957?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Carsten Ziegeler closed FELIX-4957.
-----------------------------------
> [DS][RFC-212] Various issues with field references
> --------------------------------------------------
>
> Key: FELIX-4957
> URL: https://issues.apache.org/jira/browse/FELIX-4957
> Project: Felix
> Issue Type: Bug
> Components: Declarative Services (SCR)
> Reporter: Carsten Ziegeler
> Assignee: Carsten Ziegeler
> Fix For: scr-2.0.0
>
>
> 1. The DS spec states that non-volatile fields with dynamic references is an
> error. These fields must not be injected. See 112.3.8.1:
> "For a dynamic reference, the field must be declared with the volatile
> modifier so that field value changes made by SCR are visible to other
> threads. If the field is not declared with the volatile modifier, SCR must
> log an error message with the Log Service, if present, and the field must not
> be modified."
> 2. When a field with a dynamic reference holds the service properties of the
> referenced service, the field must be modified when the referenced service's
> properties are changed.
> See 112.3.8.1: "For a dynamic reference with unary cardinality, SCR must set
> the field with initial bound service, if any, before the component instance
> is activated. When there is a new bound service or the service properties of
> the bound service are modified and the field holds service properties, SCR
> must replace the field value. "
> 3. When a component uses a static field reference holding properties for the
> referenced service and these service properties change, DS must reactivate
> the component to inject the updated service properties.
> See 112.3.8.1: "For a static reference, SCR must set the value of the field
> before the component instance is activat- ed and must not change the field
> while the component is active."
> So the component must be reactivated to receive the updated service
> properties.
> 4. When a final field is used as a reference, DS must activate the component
> but not set the field value.
> See 112.3.8.1: "If the field is declared with the final modifier, SCR must
> log an error message with the Log Service, if present, and the field must not
> be modified."
> 5. If a field reference is optional and there is no bound service, DS must
> null the field.
> See 112.3.8.1: "If the reference has optional cardinality and there is no
> bound service, SCR must set the field value to null."
> 6. The spec says that for an optional reference with no target services, DS
> must inject an empty mutable collection/list. Currentyl DS is not injecting
> the field and leaving the constructor set value.
> From 112.3.8.1:
> "Before the component instance is activated, SCR must set the field with a
> new mutable collection that must contain the initial set of bound services
> sorted using the same ordering as ServiceReference.compareTo based upon
> service ranking and service id. The new collection may be empty if the
> reference has optional cardinality and there are no bound services."
> 7. The DS spec, 112.3.8, says:
> "If the update option is used when not permitted, SCR must log an error
> message with the Log Service, if present, and the field must not be modified."
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)