Please ask this type of question on
the equinox newsgroup, the mailing list is dedicated to development issues.
OSGi provides a facility called StartLevel
service. It does exactly what you want except that the plugins within the
same start level are started in a random order and not in different threads.
If you are doing the installation of
your bundles dynamically using BundleContext.install() you then need to
use the start level service to associate the bundle with a start leve,
and after that you need to start the bundle so that when the level is reached
the framework knows that it has to start it.
If you have a fixed configuration, you
can specify the startup sequence, the start level and whether or not to
automatically start this bundle on the osgi.bundles property of the config.ini.
For example here is the value for the
# The comma-separated list of bundles
which are automatically installed and optionally started
# once the system is up and running.
Each entry if of the form
# <URL | simple bundle
location>[@ [<startlevel>] [":start"]]
# If the startlevel is omitted then
the framework will use the default start level for the bundle.
# If the "start" tag is added
then the bundle will be marked as started after being installed.
# Simple bundle locations are interepreted
as relative to the framework's parent directory.
# The startlevel indicates the OSGi
start level at which the bundle should run.
Jasper Potts <jasper@xxxxxxxxxxxxxxx> Sent by: equinox-dev-bounces@xxxxxxxxxxx
10/12/2005 02:17 PM
Please respond to
Equinox development mailing list
[equinox-dev] Ordered starting/stopping
I am in the process of porting a Swing application
to use Eclipse core
plugin engine. I have a need to control the start-up and shutdown order
of plugins. I was hopping that OSGi startlevels would provide this but
can't see that it does. What I basically need is something like unix
runlevels for starting and stopping plugins. The idea being that all
plugins in level 1 are started then all plugins in level 2 and so on
then when shutting down all plugins in level 2 are stoped followed by
all plugins in level 1. All plugins in each level should be started
concurrently in multiple threads, but the next level can't start until
all previous level plugins have finished. An example of my application
boot cycle could be:
Is there any way to do this already?
Does OSGi engine support multiple threads? Can plugins be started from
My current idea is to create a RunLevel plugin that has an
ExtensionPoint that other plugins can regsiter them selfs at a
perticular runlevel. The RunLevel plugin will then be the main
application and iterate though the runlevels asking the OSGi engine to
start each plugin at the current level and then do something similar for
shutdown. It will ask each plugin to start from a new thread.
Will this work, any better ideas?
equinox-dev mailing list