Reputation: 1407
I'm developing an OSGi based application. While documenting myself on the features of the OSGi framework I stumbled on the extension bundle concept. Citing the R4 specification (OSGi R4):
Extension bundles can deliver optional parts of the Framework implementation or provide functionality that must reside on the boot class path. These packages cannot be provided by the normal import/export mechanisms. Boot class path extensions are necessary because certain package implementations assume that they are on the boot class path or are required to be available to all clients. An example of a boot class path extension is an implementation of java.sql such as JSR 169
Probably it's just me being stupid, but I'm having difficulties on understanding the concept. I have several questions:
From what I understood it seems that extension bundles are doing the same work of org.osgi.framework.system.packages.extra
and org.osgi.framework.bootdelegation
(i.e. com.sun.*
or sun.*
). Am I right? If not, what are the differences between them?
Can you show me a real use case scenario for extension bundles? Something that says: "you can't do it unless you use extension bundles!" Here someone already tried to provide an example for extension bundles but (at least for me) it seems one can achieve the same result by tweaking org.osgi.framework.system.packages.extra
and org.osgi.framework.bootdelegation
;
I know there is already this SO answer but to me it didn't fully hit the point.
Thanks for all kind replies!
Upvotes: 3
Views: 1472
Reputation: 533520
extension bundles can be used to override any class, even java.lang classes.
You might want to trace when System.gc() is called for example (e.g. write a stack trace to a log file)
Upvotes: 1