[
https://issues.apache.org/jira/browse/FELIX-5336?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16653264#comment-16653264
]
Pierre De Rop commented on FELIX-5336:
--------------------------------------
While trying to release the R12 candidate release, someone reported to me a bug
regarding this Jira issue: sometimes a scoped service is instantiated and
started unexpectedly:
Example: let's say we have two scoped services S1, and S2 (with
scope=PROTOTYPE), and S1 depends on S2:
{code:java}
@Component(scope=PROTOTYPE)
class S1Impl implemements S1 {
@ServiceDependency
S2 s2;
...
}
@Component(scope=PROTOTYPE)
class S2Impl implemements S2 {
...
}
{code}
Now, the bug is the following: when someone requests S1, then S2 is
instantiated and started twice.
This is because when we track the service dependency for S1Impl, we
dereference the service S2 before registering the PrototypeServiceFactory in
the service registry. This is clearly a serious bug which justify to cancel the
R2 candidate release (show stopper issue , to my opinion).
> Add support for prototype scope services in DM4
> -----------------------------------------------
>
> Key: FELIX-5336
> URL: https://issues.apache.org/jira/browse/FELIX-5336
> Project: Felix
> Issue Type: New Feature
> Components: Dependency Manager, Dependency Manager Annotations,
> Dependency Manager Lambda, Dependency Manager Runtime
> Reporter: Pierre De Rop
> Assignee: Pierre De Rop
> Priority: Major
> Fix For: org.apache.felix.dependencymanager-r12
>
> Attachments: FELIX-5336.tgz
>
>
> In the users mailing list, there is a wish to add support in DM4 for OSGi
> prototype scope services, which allows any service consumer to get its own
> instance of a given service dependency.
> See http://www.mail-archive.com/[email protected]/msg17473.html
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)