-
Notifications
You must be signed in to change notification settings - Fork 258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How do service consumers know whether to use BundleContext::GetService or ServiceObjects? #325
Comments
This also begs the question about why two separate APIs exist to get service objects. I see that |
@jeffdiclemente I am not aware of the driving use case for the introduction of service scopes in OSGi. My own use case was stateful services. A service would expose an API to configure certain aspects of its behavior and the service instance is then used repeatedly by the same client. A different client should get a new instance, which has not been configured yet. Also, the service was not thread-safe but clients from different threads should be able to use it, so we used "prototype" scope to isolate service instances. The different API usage is a little unfortunate, I agree. Better documentation would certainly help new users. |
@saschazelzer Supporting stateful services seems like a good reason to introduce a prototype service scope. A google search on "stateful services" found a couple blog posts about how to implement stateful services in OSGi before prototype service scopes existed. |
Make it easier to find information on when the use ServiceObjects. Fixes #325 [ci skip] Signed-off-by: The Mathworks Inc <Roy.Lurie@mathworks.com>
Make it easier to find information on when to use ServiceObjects. Fixes #325 Signed-off-by: The Mathworks Inc <Roy.Lurie@mathworks.com>
As a service consumer, its unclear from reading the
BundleContext::GetService
documentation when to useBundleContext::GetService
overServiceObjects
. I'm proposing to make a small doc change toBundleContext::GetService
to help users understand when to use one over the other.The text was updated successfully, but these errors were encountered: