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/07 16:02:00 UTC

[jira] [Updated] (FELIX-6050) Use abstract class for PrototypeRefPair implementations for Single vs. Multiple case

     [ https://issues.apache.org/jira/browse/FELIX-6050?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Thomas Watson updated FELIX-6050:
---------------------------------
    Summary: Use abstract class for PrototypeRefPair implementations for Single vs. Multiple case  (was: Get rid of SinglePrototypeRefPair)

> 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)