Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[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



Back to the top