Reputation: 695
I have OSGI bundles implementing API specified in another bundle (addded as dependency). Is there any way to specify that whenever API bundle is restarted, restart the implenting bundles (dependents)?
Upvotes: 0
Views: 693
Reputation: 4224
I am not sure but i guess the OSGi container does this internally whenever the dependant bundle changes. There is no need for extra configuration.
However, if this is not the case, you can give a try by using the manifest header "Require-Bundle" rather than "import-package" to show the dependency to other bundles.
Upvotes: 0
Reputation: 6046
You can call refresh and all bundles will be restarted that had package wirings to the old API bundle. You can call refresh on the console or programmatically FrameworkWiring.refreshBundles(...) For more information you can check the javadoc of the mentioned function.
Upvotes: 1
Reputation: 1813
It depends, if you use Declarative Services or Blueprint in the implementation bundles to expose the services declared in the API bundle you can get such behavior.
In release 5 there is the Subsystem Specification where you can have more than one bundle inside a composite that will share a single life-cycle [1].
[1] - http://coderthoughts.blogspot.com.br/2013/04/osgi-subsystems.html
Upvotes: 1