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,
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
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.
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
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
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
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
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 =
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
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
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
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
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,
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,
14 matches
Mail list logo