You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Thomas Watson (JIRA)" <ji...@apache.org> on 2019/02/06 21:09:00 UTC

[jira] [Created] (FELIX-6050) Get rid of SinglePrototypeRefPair

Thomas Watson created FELIX-6050:
------------------------------------

             Summary: 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


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)