This section provides some recommended guidelines for creating bundles.
When you create bundles, use the following conventions:
- Clean up objects and threads properly during your stop method. The framework does not terminate lingering threads.
- Return promptly from BundleActivator start() and stop() methods. These methods are invoked synchronously by the framework. Delays in returning from these methods will affect the ability of the framework to process other bundle actions. It is recommended that substantial activities be handed off to another thread for processing, or be delayed until first service invocation.
- Return promptly from Framework and Bundle Listeners events. These event methods are invoked by the framework. Delays in returning from these methods may adversely affect performance of the framework.
- Allow for service lifecycle events. The OSGi framework provides the ability to dynamically install and remove bundles. As a result, it is possible in some frameworks that services may not always be present. A service is only present when the bundle that registered the service is available. See Getting and un-getting services from the OSGi Framework for conventions to solve this problem.
In order for your bundles/plug-ins to run on non-Eclipse versions of RCP or eRCP, they must adhere to the OSGi standard for manifests. Eclipse does not always require strict adherence. For instance, you might be able to use OSGi 4 properties without specifying "Bundle-ManifestVersion: 2". However, this will not work on strict OSGi implementations.
Parent topic: Creating OSGi bundles: XPD622