Eclipse and Lazy Start with OSGI

The new OSGI compliant lazy start logic built into Eclipse 3.2 can throw you for a loop if you are not careful. If you construct an application where you expect lazy-start bundles to actually be started lazily then you now need to make sure the bundles are never started using the Bundle.start() method. The reason is, any bundles started explicitly on the console or in with the bundle.start() method will automatically be started on next launch of the platform. This can really hit you performance wise if you are expecting plugins to always lazy-start (well, at least the ones who specify this in their manifest).

So a best practice is to never call the start() method explicitly on a bundle.

or

If you absolutely have to start a bundle then look up the bundle and call load class on an arbitrary method. This will load the bundle naturally (lazy by class-loading) and you will not be susceptible to the problem above. 🙂

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.