What is the difference between bootdelegation and DynamicImport-Package in osgi

Both will resolve package dependencies in osgi, what's the difference between them

+3


source to share


2 answers


Bootdelegation is a hack that is necessary because some code inside the VM assumed that the application classloaders had visibility for the com.sun classes. *. In OSGi, this is obviously not the case. Load delegation is a parameter that specifies which packages the framework can search for in the load class path. Since it's not modular, don't do it. This is global to the framework.



DynamicImport-Package is similar, but only for package it is defined in and only for exported packages. If the package cannot be found in the normal contents of the package or Import-Package, then the DynamicImport-Package specifies the package templates that are allowed to be searched in the set of exported packages. This idea is similar to the classpath, you have no idea what version you are going to get. Once a package is found, it is used forever. However, if it is not found, each access will keep looking. That is, you can install the package after the fact without restarting the package.

+13


source


Packages imported via DynamicImport-Package are resolved whenever a class from the package is required. So if the package is not available due to the resolution process, it won't let you down. Therefore, ClassNotFoundExceptions can be thrown at runtime. (compare this with additional imports)



the BootDelegation classes will be loaded from the bootdelegation class loader, which is a class loader that loads the OSGi environment into the JVM http://wiki.osgi.org/wiki/Boot_Delegation http://www2.sys-con.com/itsg/virtualcd/java /archives/0808/chaudhri/index.html http://de.slideshare.net/honnix/osgi-class-loading

+1


source







All Articles