Re: [osgi-dev] Disposing component instances

2018-11-25 Thread Alain Picard via osgi-dev
Thanks Raymond On Sun, Nov 25, 2018, 6:58 PM Raymond Auge Please note that up to a couple of weeks ago there was a bug in Felix SCR > managing indirect component prototype instances. > > https://issues.apache.org/jira/browse/FELIX-5974 > > So you may want to make sure you have the latest. > > -

Re: [osgi-dev] Disposing component instances

2018-11-25 Thread Raymond Auge via osgi-dev
Please note that up to a couple of weeks ago there was a bug in Felix SCR managing indirect component prototype instances. https://issues.apache.org/jira/browse/FELIX-5974 So you may want to make sure you have the latest. - Ray On Sun, Nov 25, 2018, 08:21 Alain Picard via osgi-dev <

Re: [osgi-dev] Disposing component instances

2018-11-25 Thread Tim Ward via osgi-dev
> Small slant to this question, let's say that X has a reference to Factory A > (standard component) and that factory A returns a prototype scoped instance, > will ungetting X, release the instance returned by factory A? The simple answer is yes, the in depth answer is “not always” due to the

Re: [osgi-dev] Disposing component instances

2018-11-25 Thread Alain Picard via osgi-dev
On Sun, Nov 25, 2018 at 7:50 AM Tim Ward wrote: > If your DS component ‘X’ is injected with a Component Service Objects > which it uses to get instances ‘A’, ‘B’ and ‘C' of a referenced service > then those service instances will be released when either: > > >- The component ‘X’ releases

Re: [osgi-dev] Disposing component instances

2018-11-25 Thread Tim Ward via osgi-dev
If your DS component ‘X’ is injected with a Component Service Objects which it uses to get instances ‘A’, ‘B’ and ‘C' of a referenced service then those service instances will be released when either: The component ‘X’ releases them by calling ungetService on the component service objects or

Re: [osgi-dev] Disposing component instances

2018-11-25 Thread Alain Picard via osgi-dev
Tim, Circling back on this. Re-reading section 112.3.6 it says "This means that if a component instance used a Component Service Objects object to obtain service objects, SCR must track those service objects so that when the service becomes unbound, SCR can unget any unreleased service objects".

Re: [osgi-dev] Disposing component instances

2018-08-23 Thread Alain Picard via osgi-dev
On Thu, Aug 23, 2018 at 9:20 AM Tim Ward wrote: > If you’re using Declarative Services to consume these other dynamic > references then there is no need to worry. > That's what I'm doing. If you’re trying to programmatically write a prototype scoped service that > has service dependencies then

Re: [osgi-dev] Disposing component instances

2018-08-23 Thread Tim Ward via osgi-dev
If you’re using Declarative Services to consume these other dynamic references then there is no need to worry. If you’re trying to programmatically write a prototype scoped service that has service dependencies then stop and use DS instead. Trying to correctly manage the “unget” chains that

Re: [osgi-dev] Disposing component instances

2018-08-23 Thread Alain Picard via osgi-dev
Just a small note, I should have stated that my worry is about the unget timing. I obviously have a reference to the object and this won't disappear by itself, but if that service has other dynamic references that go away and I keep using the service, I might be in trouble. But I guess the

Re: [osgi-dev] Disposing component instances

2018-08-23 Thread Alain Picard via osgi-dev
Tim, Based on your referenced javadoc, some more googling, I used and adapted from our own current tracker and supplier to create some Prototype versions. Tests are showing correct results, but this is not directly using the PrototypeServiceFactory, so I would appreciate a very quick confirmation

Re: [osgi-dev] Disposing component instances

2018-08-22 Thread Alain Picard via osgi-dev
Thanks! I actually saw that being called by ComponentServiceObjects while perusing the code. Alain On Wed, Aug 22, 2018 at 11:52 AM Tim Ward wrote: > Registering a prototype service is almost as easy as registering a > singleton service. Instead of registering a single object you register an

Re: [osgi-dev] Disposing component instances

2018-08-22 Thread Tim Ward via osgi-dev
Registering a prototype service is almost as easy as registering a singleton service. Instead of registering a single object you register an instance of PrototypeServiceFactory . This will get called by the

Re: [osgi-dev] Disposing component instances

2018-08-22 Thread Alain Picard via osgi-dev
Tim, This helps quite a bit and clarifies a few points for me. As someone who is migrating from a pre-DS environment and dealing with lots of legacy, how can prototype scoped services be used outside of DS? That would be fantastic. Right now we have a good solution to use singleton services

Re: [osgi-dev] Disposing component instances

2018-08-22 Thread Tim Ward via osgi-dev
Hi Alain, A "Prototype scoped" service is one where the client(s) can request an arbitrary number of instances of the “same” service, whereas a ComponentFactory is a mechanism for the clients to request an arbitrary number of differently configured component instances. From the perspective of

Re: [osgi-dev] Disposing component instances

2018-08-22 Thread Alain Picard via osgi-dev
On the 2nd part of the question regarding ComponentFactory/ComponentInstance vs Prototype/ComponentServiceObjects. I get the feeling that CSO should be favored, but I saw an old post from Scott Lewis about configuration and that is a bit close to some of my use cases. I have cases where I have a

Re: [osgi-dev] Disposing component instances

2018-08-22 Thread Tim Ward via osgi-dev
> On 21 Aug 2018, at 20:53, Paul F Fraser via osgi-dev > wrote: > > On 22/08/2018 5:40 AM, Paul F Fraser via osgi-dev wrote: >> On 21/08/2018 10:00 PM, Tim Ward via osgi-dev wrote: >>> Have you looked at what the OSC project does? It uses Vaadin, and uses the >>> ViewProvider interface to

Re: [osgi-dev] Disposing component instances

2018-08-21 Thread Paul F Fraser via osgi-dev
On 22/08/2018 5:40 AM, Paul F Fraser via osgi-dev wrote: On 21/08/2018 10:00 PM, Tim Ward via osgi-dev wrote: Have you looked at what the OSC project does? It uses Vaadin, and uses the ViewProvider interface to provide view instances. These automatically have a detach listener added on creation

Re: [osgi-dev] Disposing component instances

2018-08-21 Thread Paul F Fraser via osgi-dev
On 21/08/2018 10:00 PM, Tim Ward via osgi-dev wrote: Have you looked at what the OSC project does? It uses Vaadin, and uses the ViewProvider interface to provide view instances. These automatically have a detach listener added on creation so that they get correctly disposed when their parent

Re: [osgi-dev] Disposing component instances

2018-08-21 Thread Alain Picard via osgi-dev
Tim, I didn't know anything about OSC, so hadn't looked but we use ZK which is quite similar to Vaadin, so the use case is pretty similar and this provides a nice point of reference. Thanks Alain On Tue, Aug 21, 2018 at 8:00 AM Tim Ward wrote: > Have you looked at what the OSC project does?

Re: [osgi-dev] Disposing component instances

2018-08-21 Thread Tim Ward via osgi-dev
Have you looked at what the OSC project does? It uses Vaadin, and uses the ViewProvider interface to provide view instances. These automatically have a detach listener added on creation so that they get correctly disposed when their parent container is closed. See