On Fri, Oct 17, 2014 at 4:01 PM, BJ Hargrave <[email protected]> wrote:

> More detail is needed. Where "within a ServiceTracker" are you putting
> this? If it is in addingService,


yes exactly!


> then you will only ever get one service object per service, so the change
> doesn't really do anything.


well it does in that you now naturally allow trackers to obtain prototype
scoped objects


> And you would also have to pair this with a change to removedService to
> release the service through the ServiceObjects object.
>

Naturally!


>
> If the point is that if multiple trackers for a service are opened within
> a bundle, then, yes, each such tracker could obtain a different service
> object for prototype scope services.
>

Exactly what I was wondering, and why? Because in a case `similar` to DS
where multiple components in a bundle all request the same service, they
would each have their own tracker, if that service were of prototype scope,
I'm guessing each would be getting their own instance.... If I've
understood correctly.

- Ray


> --
>
>  *BJ Hargrave*
> Senior Technical Staff Member, IBM
> OSGi Fellow and CTO of the *OSGi Alliance* <http://www.osgi.org/>
> *[email protected]* <[email protected]>
>
> office: +1 386 848 1781
> mobile: +1 386 848 3788
>
>
>
>
>
> From:        Raymond Auge <[email protected]>
> To:        OSGi Developer Mail List <[email protected]>
> Date:        2014/10/17 15:16
> Subject:        [osgi-dev] prototype scope and service trackers
> Sent by:        [email protected]
> ------------------------------
>
>
>
> Is it fair to say that, within a ServiceTracker I can safely replace:
>
> S s = bundle.getService(servlceReference);
>
> with
>
> ServiceObjects<S> so = bundle.getServiceObjects(serviceReference);
> S s = so.getService();
>
>
> which would mean that only where a bundle implemented more than one such
> tracker could the bundle ever get more than one instance! Correct?
>
> --
> *Raymond Augé* <http://www.liferay.com/web/raymond.auge/profile>
>  (@rotty3000)
> Senior Software Architect
> *Liferay, Inc.* <http://www.liferay.com/> (@Liferay)
> _______________________________________________
> OSGi Developer Mail List
> [email protected]
> https://mail.osgi.org/mailman/listinfo/osgi-dev
>
>
> _______________________________________________
> OSGi Developer Mail List
> [email protected]
> https://mail.osgi.org/mailman/listinfo/osgi-dev
>



-- 
*Raymond Augé* <http://www.liferay.com/web/raymond.auge/profile>
 (@rotty3000)
Senior Software Architect
*Liferay, Inc.* <http://www.liferay.com> (@Liferay)
_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to