No matter how you get your service hooks registered there is always a timing issue to contend with. Any bundles that interact with the service registry before your hooks are registered will see the services you may be trying to hide. Out of necessity service hooks are low level and need to be registered with the system as early as possible. Using DS or any other extender to get your service hooks registered places just one more dependency from your hook implementation which means more things need to get started before your service comes on line. This risks leaking the service you want to hide.
The recommended approach is to register your service hooks using the the BundleContext directly from a bundle activator and set the start-level of your bundle to the lowest possible start-level before all other bundles get started. In the future R6 core spec you may even consider using a framework extension so your hooks are in place before the framework is even started. Tom From: Cristiano Gavião <[email protected]> To: OSGi Developer Mail List <[email protected]>, Date: 01/12/2014 01:50 PM Subject: [osgi-dev] FindHook and EventListenerHook would work well if registered with DS? Sent by: [email protected] Hello OSGi experts, I would like to use FindHook and EventListenerHook to restrict service wiring for some packages. I know they can be registered using DS as any other service. But my doubt is, if I use DS to register the FindHook and EventListenerHook I still be able to interfere in the way services are wired or will be too late? btw, when DS will not be a good choice and I'll need to go to BundleActivator ? thanks a lot for any tip, regards, Cristiano _______________________________________________ OSGi Developer Mail List [email protected] https://mail.osgi.org/mailman/listinfo/osgi-dev
<<inline: graycol.gif>>
_______________________________________________ OSGi Developer Mail List [email protected] https://mail.osgi.org/mailman/listinfo/osgi-dev
