[ https://issues.apache.org/jira/browse/FELIX-6050?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16762802#comment-16762802 ]
Thomas Watson commented on FELIX-6050: -------------------------------------- OK, we can keep the two versions, but I am going to refactor the code a bit so the two implementations Single vs. Multiple can share common code for dealing with ServiceObjects. > Use abstract class for PrototypeRefPair implementations for Single vs. > Multiple case > ------------------------------------------------------------------------------------ > > 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)