[equinox-dev] bug or not

2014-04-28 Thread Raymond Auge
Hey all, I have to write code as follows in a ServiceFactory impl in order for my factory to always return the same instance per bundle running on equinox 3.8.0.v20120529-1548 === public HttpService getService( Bundle bundle,

Re: [equinox-dev] bug or not

2014-04-28 Thread BJ Hargrave
You don't have to manage the instance. The framework, per spec, must cache the instance the return it for future BundleContext.getService calls. I am quite sure Equinox is fine here. Never heard of a problem in this area. You don't mention what version you use. -- BJ Hargrave Senior Technical

Re: [equinox-dev] bug or not

2014-04-28 Thread Raymond Auge
equinox 3.8.0.v20120529-1548 - Ray On Mon, Apr 28, 2014 at 4:30 PM, BJ Hargrave hargr...@us.ibm.com wrote: You don't have to manage the instance. The framework, per spec, must cache the instance the return it for future BundleContext.getService calls. I am quite sure Equinox is fine here.

Re: [equinox-dev] bug or not

2014-04-28 Thread Thomas Watson
You seem to be implementing the work that the framework already does for ServiceFactory registrations. The framework will only call your factory once as long as the use count of the service is greater than zero for a particular bundle. The framework will then cache that service instance and

Re: [equinox-dev] bug or not

2014-04-28 Thread Raymond Auge
On Mon, Apr 28, 2014 at 5:17 PM, Thomas Watson tjwat...@us.ibm.com wrote: You seem to be implementing the work that the framework already does for ServiceFactory registrations. The framework will only call your factory once as long as the use count of the service is greater than zero for a

Re: [equinox-dev] bug or not

2014-04-28 Thread Raymond Auge
I agree that I should NOT have to implement this code. However, I'm having to do so in order to work around this apparent issue. - Ray On Mon, Apr 28, 2014 at 5:23 PM, Raymond Auge raymond.a...@liferay.comwrote: On Mon, Apr 28, 2014 at 5:17 PM, Thomas Watson tjwat...@us.ibm.comwrote: You

Re: [equinox-dev] bug or not

2014-04-28 Thread Thomas Watson
Is your ServiceFactory.ungetService getting called each time? If so then it is likely the felix webconsole is using an anti pattern like this: HttpService service = bc.getService(httpServiceRef); /// do some work with http service bc.ungetService(httpServiceRef); If they are getting/ungetting

Re: [equinox-dev] bug or not

2014-04-28 Thread Raymond Auge
will check! Thx, - Ray On Mon, Apr 28, 2014 at 5:37 PM, Thomas Watson tjwat...@us.ibm.com wrote: Is your ServiceFactory.ungetService getting called each time? If so then it is likely the felix webconsole is using an anti pattern like this: HttpService service =

Re: [equinox-dev] bug or not

2014-04-28 Thread Richard S. Hall
On 4/28/14, 17:37 , Thomas Watson wrote: Is your ServiceFactory.ungetService getting called each time? If so then it is likely the felix webconsole is using an anti pattern like this: HttpService service = bc.getService(httpServiceRef); /// do some work with http service

Re: [equinox-dev] bug or not

2014-04-28 Thread Thomas Watson
But for the HttpService I consider this an anti-pattern. When a bundle's usecount reaches zero the HttpService implementation must unregister all resources registered by that bundle. If that is really what the webconsole bundle wants then that is fine and I agree with you. But if the

Re: [equinox-dev] bug or not

2014-04-28 Thread Richard Hall
If you only meant for registering resources with the HttpService, then i can agree with that. :-) - richard On Apr 28, 2014 8:59 PM, Thomas Watson tjwat...@us.ibm.com wrote: But for the HttpService I consider this an anti-pattern. When a bundle's usecount reaches zero the HttpService

Re: [equinox-dev] bug or not

2014-04-28 Thread Raymond Auge
Hey all, I think I may have gotten a false positive on some tests because this week I can't reproduce it. Seems you should test code again after a week off. Glad I didn't file a ticket. Excuse the noise, Ray On Apr 28, 2014 9:07 PM, Richard Hall he...@ungoverned.org wrote: If you only meant

Re: [equinox-dev] bug or not

2014-04-28 Thread Thomas Watson
I meant for any service that maintains state for the duration of usage for each using bundle. Luckily that is not common for the services that the OSGi specification defines. HttpService is probably the most commonly used one that has to maintain state for using bundles. Regardless of that,

Re: [equinox-dev] bug or not

2014-04-28 Thread Richard Hall
I'd agree if you are using a service constantly, it doesn't makes sense to release it after each use. It is less clear when it is not a constant need. Of course, HttpService perhaps causes acute pain since it is from a time before the whiteboard pattern... - richard On Apr 28, 2014 9:54 PM,