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

David Jencks commented on FELIX-6050:
-------------------------------------

The motivation was to provide a simpler quicker code path when there was only 
the one component with the reference; it leaves out a map and a map lookup.  I 
still think the two versions make some sense but I'm not going to argue.  It's 
not going to make any timing difference unless the component is using the 
locator strategy repeatedly over and over again; it does make a slight space 
difference.

> Get rid of SinglePrototypeRefPair
> ---------------------------------
>
>                 Key: FELIX-6050
>                 URL: https://issues.apache.org/jira/browse/FELIX-6050
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR)
>    Affects Versions: scr-2.1.14
>            Reporter: Thomas Watson
>            Assignee: Thomas Watson
>            Priority: Minor
>
> The SCR implementation has two classes that keep track of prototype 
> references from a service component:
> org.apache.felix.scr.impl.manager.MultiplePrototypeRefPair
> org.apache.felix.scr.impl.manager.SinglePrototypeRefPair
> I'm not entirely sure what motivated the need for Multiple vs. Single here.  
> The Single one gets used if the service component is a singleton service 
> component.  The Multiple one gets used for service components that are bundle 
> or prototype service components.  The Multiple one will key the instances of 
> the referenced prototype service by the ComponentContextImpl for the 
> requiring service component.  That way if there are multiple instances of the 
> requiring component each instance (and therefore ComponentContextImpl 
> insteance) will get a unique instance of the required prototype service.
> It appears the thought was that some optimizations could have been realized 
> for the Singleton case so it has a specialized class separate from Multiple.  
> But I think this only makes the code hard to understand and I question that 
> the current state of the code is providing any performance improvement.
> I propose we remove the SinglePrototypeRefPair and rename the 
> MultiplePrototypeRefPair to be simply PrototypeRefPair.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to