On 19 Feb 2011, at 11:25 , Neil Bartlett wrote: > You could simply write a bundle that starts all bundles and waits for > them to reach ACTIVE state (a BundleListener or BundleTracker will > help you with this part). Once all the bundles you know about are > active, your system should be in its "ready" state, and if it is not > then you can work out what went wrong. Likewise if any bundle fails to > start then you will get a specific error about that bundle. > > Incidentally this is how the JUnit executor in Bndtools works... it > starts all bundles, waits for them all to reach active state, then > begins running any testcases it can find in the bundles.
In some real-world systems I've seen, even that is not enough, as some of the dynamics happen even after all bundles have gone into their active state. The spec states that a BundleActivator.start() method should return in a timely manner, so if it needs to do a lot of work, it should probably start a background thread. If any of that work leads to, for example, more services being registered, even waiting for all bundles to reach the active state will not be enough. In short this confirms the statement that only you, as the designer of the system, will be able to come up with a good algorithm that defines when your system is "up and running". Greetings, Marcel _______________________________________________ OSGi Developer Mail List [email protected] https://mail.osgi.org/mailman/listinfo/osgi-dev
