When you call .start() on a bundle it *marks* it as started; this is a persistent marker that remains on the bundle even after shutting down OSGi. Therefore the next time the framework starts, the bundle is still marked as started which is why the framework restarts it.
Note that you can avoid this behaviour by calling start(Bundle.START_TRANSIENT), which starts the bundle without setting the persistent marker. Also, calling start() on a bundle doesn't necessarily start it immediately, for example the bundle might have been given a start-level that the framework has not yet reached. In ALL cases, start() MUST have been called at some time before a bundle will start. I.e. bundles must always be explicitly started by somebody; the framework never really "automatically" starts bundles. Regards Neil On Wed, Jul 25, 2012 at 5:37 PM, <[email protected]> wrote: > I'm kind of unclear on when and how the BundleActivator.start() method get's > called. I understand that when I invoke the bundle.start(), which my app > does, that the lifecycle method get's called too. What I'm unclear about are > the other conditions which would lead to an invocation. For instance, it > seems like the container automatically calls it when I restart my > application. Does it do that for all bundles in the "running" state? > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

