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

Arnoud Glimmerveen commented on FELIX-6161:
-------------------------------------------

Based on the example outlined in FELIX-4964:

bq. most likely scenario is field references for object, properties, service 
ref all for the same service

I assumed it was referring to the ability of SCR to inject the service 
directly, or for example the service reference of that same service. In that 
use case I think it makes sense you'll be using the same target filter options.

Indeed if you want to deal with different target filters that happen to match 
the same service, then my patch would not no longer address that. If that is 
the desired behaviour then an alternative approach I see is to register an 
additional service that covers the complete service need (className + target 
filter) with the sole purpose to signal observers to complete picture. But that 
would result in additional service listeners for each reference with a target 
filter configured. 

Another thought/question: a service could list multiple classNames in the 
objectClass property, which in the context of FELIX-4964's solution would 
result in separate events when the individual classes are referenced from the 
same component, or does the solution to FELIX-4964 also cover that aspect?

> SCR: Method of resolving references limits Service ListenerHook 
> implementations
> -------------------------------------------------------------------------------
>
>                 Key: FELIX-6161
>                 URL: https://issues.apache.org/jira/browse/FELIX-6161
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR)
>    Affects Versions: scr-2.1.16
>            Reporter: Arnoud Glimmerveen
>            Priority: Major
>         Attachments: FELIX-6161.patch
>
>
> When experimenting with creating a Service ListenerHook to realise a 
> [providing a service on demand 
> pattern|https://osgi.org/specification/osgi.core/7.0.0/framework.servicehooks.html#d0e45721],
>  I noticed that references from components managed by Felix SCR were not 
> showing up as expected: When a reference declares a target filter, that 
> target filter is not included in the ListenerInfo provided to the 
> ListenerHook. As a consequence the ListenerHook is unable to create a 
> matching service.
> Source of the observed behaviour is how SCR tracks references, specifically 
> that it opens a ServiceListener for just the className and performs the 
> matching of the target filter inside the ServiceListener. This approach 
> unfortunately hides the target filter from the Service ListenerHook and thus 
> the Service ListenerHook will have insufficient information to create a 
> matching service.
> Also look at the discussion on the dev mailing list: 
> [https://www.mail-archive.com/[email protected]/msg48657.html] 



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

Reply via email to