There is no way for a bundle to get the framework to abort startup.

The best you can do is have your bundle run in a lower start level than all other bundles and have the framework start up in this lower start level first. Then once the framework started (i.e., your bundle gets the framework started event), then it can decide if it needs to shutdown or change the start level to be higher to start the rest of the bundles.

-> richard


On 3/9/11 10:21, Andrea Zoppello wrote:
Hi all,

Is it possible to stop the framework inside a bundle activator start method?

I'm asking this, because i need to have a bundle ( that i configure to start ) with startup level lower than other that need to do some configuration steps ( setting properties, prepare resources
and so on )

My need is to stop the framework and exit if something goes wrong in this so called start-up bundle.

1) I've try to do get a reference to the system bundle and to stop by doing this:

Bundle mainBundle = context.getBundleContext().getBundle(0);
mainBundle.stop();

but this seem don't work ( i seeequinox simple configurator continue to process the bundle list ).

2) Another thing i try is to call the System.exit(0), it works but i don't know if it's correct...

Which is the cleanest and right way to proceed in that case??

Andrea

_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev
_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to