Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [equinox-dev] Ordered starting/stopping of plugins


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 eclipse SDK:

# 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.
osgi.bundles=org.eclipse.core.runtime@2:start, org.eclipse.update.configurator@3:start

HTH,

PaScaL



Jasper Potts <jasper@xxxxxxxxxxxxxxx>
Sent by: equinox-dev-bounces@xxxxxxxxxxx

10/12/2005 02:17 PM

Please respond to
Equinox development mailing list

To
equinox-dev@xxxxxxxxxxx
cc
Subject
[equinox-dev] Ordered starting/stopping of plugins





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:


==START APP======================================
---LEVEL-1-------------------------------------------------------------
core & libs
---LEVEL-2-------------------------------------------------------------
network & messageing
---LEVEL-3-------------------------------------------------------------
database
---LEVEL-4-------------------------------------------------------------
core ui plugins
---LEVEL-5-------------------------------------------------------------
main application plugins
==APP RUNNING===================================
...
==APP STOPPING===================================
---LEVEL-5-------------------------------------------------------------
main application plugins
---LEVEL-4-------------------------------------------------------------
core ui plugins
---LEVEL-3-------------------------------------------------------------
database
---LEVEL-2-------------------------------------------------------------
network & messageing
---LEVEL-1-------------------------------------------------------------
core & libs
==APP STOPPED====================================

Is there any way to do this already?
Does OSGi engine support multiple threads? Can plugins be started from
multiple threads?

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?

Many Thanks

Jasper Potts

_______________________________________________
equinox-dev mailing list
equinox-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/equinox-dev


Back to the top