You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Pierre De Rop (JIRA)" <ji...@apache.org> on 2016/11/20 23:17:58 UTC

[jira] [Comment Edited] (FELIX-5336) Add support for prototype scope services in DM4

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

Pierre De Rop edited comment on FELIX-5336 at 11/20/16 11:17 PM:
-----------------------------------------------------------------

Thanks Jan Willem for the feedback. It's indeed making a lot of sense.
I guess you are talking about ServiceObjects, not ServiceReference ?

Injecting a ServiceReference is already possible, except that I need to do a rework in order to not internally instantiate the service using ServiceObjects.getService() method.
Then I will add support for injecting a ServiceObjects like this:

{code}
Client.bind(ServiceObjects<Service> serviceObjects) {
    // the client will be able to instantiate the scoped service instance by calling serviceObjects.get():
    Service clone = serviceObjects.get();
    
    // and once the client is done, it will then have to invoke serviceObjects.ungetService(Object obj):
    serviceObjects.ungetService(clone);
}
{code}

I hope to attach a working patch this week (or the next week-end), and would appreciate if you could give it a try before I commit anything to the trunk.
(in case you have more feedbacks ...)

thanks a lot :-)


was (Author: pderop):
Thanks Jan Willem for the feedback. It's indeed making a lot of sense.
I guess you are talking about ServiceObjects, not ServiceReference ?

Injecting a ServiceReference is already possible, except that I need to do a rework in order to not internally instantiate the service using ServiceObjects.getService() method.
Then I will add support for injecting a ServiceObjects like this:

Client.bind(ServiceObjects<Service> serviceObjects) {
    // the client will be able to instantiate the scoped service instance by calling serviceObjects.get():
    Service clone = serviceObjects.get();
    
    // and once the client is done, it will then have to invoke serviceObjects.ungetService(Object obj):
    serviceObjects.ungetService(clone);
}

I hope to attach a working patch this week (or the next week-end), and would appreciate if you could give it a try before I commit anything to the trunk.
(in case you have more feedbacks ...)

thanks a lot :-)

> 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
>    Affects Versions: org.apache.felix.dependencymanager-r8
>            Reporter: Pierre De Rop
>            Assignee: Pierre De Rop
>             Fix For: org.apache.felix.dependencymanager-r9
>
>         Attachments: PrototypeServiceFactoryTest.java
>
>
> 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/users@felix.apache.org/msg17473.html



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)