On 28.04.2009, at 22:39, Luc Dewavrin wrote:
Hi,
I have a newbie question regarding bundle lifecycle and declarative
services
lifecycle : are they linked together ?
Your DS components are created and activated only if the bundle
containing them is ACTIVE (i.e. started). As soon as this bundle is
stopped, your components are disposed.
I would like the services of my bundle to be singletons and my
bundle should
be activated only when services are instantiated. Is it possible to
do that
by configuration ?
Can a service by declaration become a singleton in my bundle ( a la
Spring
container) ? i mean all the services dependent on that service
should be
bound with the same implementation (for a given bundle).
Not sure about DS because it uses the global service registry. But it
should use the "better" available service provider. So, if you use the
"service.ranking" property you can achieve this (every consumer will
se the best provider). However for sure iPOJO supports that thanks to
its composite. A composite is a kind of isolated service registry, so
every component instance living in the composite use only services
from this service registry.
Considering that my service is a singleton. If i instantiate it in the
bundle activator, can i force my bundle to be activated only when the
service is loaded ?
Maybe it is possible to to that with the lazzy activation. So, the
bundle is activated only when the first class of the bundle is loaded.
Clement
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]