-
1. Re: Multiple instances for a service
davsclaus Sep 25, 2011 7:01 AM (in response to rogelio_sevilla1)In Spring lingo, that would be a prototype scoped bean.
Are you using spring-dm or OSGi blueprint?
-
2. Re: Multiple instances for a service
rogelio_sevilla1 Sep 25, 2011 1:57 PM (in response to davsclaus)Thanks a lot for your answer mr. Davsclaus, i'm using OSGi blueprint. Is it possible to achieve this behaviour with the OSGi blueprint??
Thanks in advance
-
3. Re: Multiple instances for a service
davsclaus Sep 26, 2011 2:25 AM (in response to rogelio_sevilla1)Yes I think that is doable, but the documentation at Apache Aries is not giving any examples, but stating its possible. See
http://aries.apache.org/modules/blueprint.html
http://www.osgi.org/javadoc/r4v42/org/osgi/service/blueprint/container/BlueprintContainer.html
But it seems this article shows how to
http://www.ibm.com/developerworks/opensource/library/os-osgiblueprint/index.html
-
4. Re: Multiple instances for a service
rogelio_sevilla1 Sep 26, 2011 12:28 PM (in response to davsclaus)Thanks a lot for the answer mr. Davsclaus, I really appreciate it, I have changed my service definition to:
However, i'm getting the same results :-S , Every time I get a service object on my clients, i always get the same instance.
I'm sorry if this is a basic/dumb question but, are we supposed to handle concurrency on every method within every bundle that we expose as a service on the esb given that we always get the same instance?? , or, am I approaching the problem in a wrong way?
Thanks a lot in advance.
-
5. Re: Multiple instances for a service
rogelio_sevilla1 Sep 27, 2011 2:15 PM (in response to rogelio_sevilla1)I just read this paragraph on the Osgi in action book:
"The framework caches factory-created service instances, so a bundle requesting the
same service twice receives the same instance. This cached instance is removed only
when the bundle has completely finished with a service (that is, the number of calls to
get it match the calls to unget it), when the bundle has stopped, or when the service
factory is unregistered."
Seems like the whole OSGI philosophy mandates this behaviour. Doesn't this hinder services scalability???. Anyway, i think for now i will export the classes I need and instantiate them on my consumers.
Thanks a lot mr. Davsclaus for the help.