Tom Watson created FELIX-6317:
---------------------------------

             Summary: dynamic greedy optional/mandatory references can get 
wrong service ranking
                 Key: FELIX-6317
                 URL: https://issues.apache.org/jira/browse/FELIX-6317
             Project: Felix
          Issue Type: Bug
          Components: Declarative Services (SCR)
            Reporter: Tom Watson


@Reference(service = Service.class, cardinality = 
ReferenceCardinality.OPTIONAL, policy = ReferencePolicy.DYNAMIC, policyOption = 
ReferencePolicyOption.GREEDY)

OR

@Reference(service = Service.class, cardinality = 
ReferenceCardinality.MANDATORY, policy = ReferencePolicy.DYNAMIC, policyOption 
= ReferencePolicyOption.GREEDY)

The above references may get injected with a service that is not the highest 
ranked service in scenarios that involve multiple threads registering the 
referenced service with different service rankings at the same time.

If more than one thread is registering the service type with different rankings 
it is random which will be the final reference bound to the component.  The 
expected result is that the highest ranked service is the final service bound 
to the component.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to