0

OSGi version 5, via Felix version 4.4.1.

I'm embedding the framework, purely via the OSGi API, nothing Felix-specific. So, I use the SPI to obtain the framework class name, create an instance, and init it.

Then I install bundles, start all the bundles, and start() the framework.

Now, if something goes wrong, a framework event will be delivered. Felix delivers these on a separate thread. How can I synchronize event delivery with start() returning? FrameworkStartLevel.setStartLevel has an option to accept listeners and guarantee that they will be called before it returns, but that only helps if I'm going to bump the start level above 1. I guess I could set all the bundles to start level 2, and thus defer their startup until I made a call to bump the level to 2, and thus get the desired sync. Is there any simpler way to just leave everything at level 1?

bmargulies
  • 97,814
  • 39
  • 186
  • 310

0 Answers0