[ 
https://issues.apache.org/jira/browse/FELIX-6589?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17682092#comment-17682092
 ] 

Tom Watson commented on FELIX-6589:
-----------------------------------

updated only applies to method injection:  
https://docs.osgi.org/specification/osgi.cmpn/8.0.0/service.component.html#d0e32833

bq. If an active component is bound to a service that modifies its service 
properties then the component can be updated. If the reference uses field 
injection and the field holds the service properties, the field must be set for 
the updated bound service. Then, if the reference uses method injection and 
specifies an updated method, the updated method must be called.

If my understanding is correct the updated value is ignored for field and 
constructor injection.  If you do not agree then I suggest a specification 
issue be opened.

> update method with constructor injection does not work
> ------------------------------------------------------
>
>                 Key: FELIX-6589
>                 URL: https://issues.apache.org/jira/browse/FELIX-6589
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR)
>    Affects Versions: scr-2.2.6
>            Reporter: Jürgen Albert
>            Priority: Major
>
> I have a scenario, where I use constructor injection and on one of the 
> references I get an update method is defined. When the properties of the 
> registered service change the update method is never called however. 
> When I move the Reference from the constructor to a usual bind method, or 
> even with a duplicated on it works like a charm.  
> The Constructor looks as follows:
> {code:java}
>       public DefaultResourceSetFactoryComponent(ComponentContext ctx,
>                       @Reference(name="resourceFactoryRegistry", 
> unbind="unsetResourceFactoryRegistry", updated = 
> "modifiedResourceFactoryRegistry")
>                       ServiceReference<Resource.Factory.Registry> 
> resourceFactoryRegistryReference
>                       ) {
> {code}
> The bind method that works looks as follows:
> {code:java}
> @Reference(policy=ReferencePolicy.STATIC, 
> unbind="unsetResourceFactoryRegistry", updated = 
> "modifiedResourceFactoryRegistry")
>       public void setResourceFactoryRegistry(Resource.Factory.Registry 
> resourceFactoryRegistry, Map<String, Object> properties) {
> {code}
> Both update methodes are mentioned correctly in the resulting component xml.
> I also played around with ComponentServiceObjects, ServiceReference and the 
> service itself. Result stays the same.
> If the Spec says that this is the correct behavior that I can't fin the 
> passage.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to