Hi Peter,
I try to explain well, at the moment i've not *dependency* problem
within configuration. All is ok, i've managed dependencies beteween
bundles, and i've solved dependencies problem at service level,
publishing a IStarteupService
within my startup bundle.
My usecase is very simple.... if something goes wrong within
configuration done in the start method of the activator of my startup
bundle, i would like to find a way to stop the container...
The situation i've now is *quite good* now in that sense: if in the the
startup bundle some error occurs this would not publish in the registry
the IStarteupService, and this cause other bundles are not able to
activate other services of my application ( because i made my services
with DS and declared a mandatory dependency on IStarteup bundle ).
The *only problem* here, is that in the situation described above i've
an OSGi container, with no services exposed
so not very useful... :-)
The solution i've found at the moment, is to stop the osgi container
with (equinox ) console, when i check that, for this
reason i ask if is there a way to it automatically...
Andrea
Il 10/03/2011 08:48, Peter Kriens ha scritto:
The question your question raised with me what is the use case to stop? In true
OSGi sense you should just wait until your dependencies are found instead of
quitting. This allows the deployer to add the additional dependencies instead
of having to start over. I always find this approach rather brittle, though
pervasive in the enterprise world.
There are cases where the approach to abort is needed but those are rather rare
imho.
Kind regards,
Peter Kriens
On 9 mrt 2011, at 16: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
_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev