[英]What is the difference between bootdelegation and DynamicImport-Package in osgi
两者都将解决osgi中的包依赖关系,它们之间有什么区别
Bootdelegation is a hack that is needed because some code inside the VM assumed that application class loaders had visibility to com.sun.* classes. Bootdelegation是一个需要的hack,因为VM中的一些代码假定应用程序类加载器具有com.sun。*类的可见性。 In OSGi, this is obviously NOT the case.
在OSGi中,显然不是这种情况。 Boot delegation is parameter that specifies for which packages the framework may do a lookup on the boot classpath.
引导委派是一个参数,它指定框架可以在引导类路径上执行查找的包。 Since this is not modular, don't do it.
由于这不是模块化的,所以不要这样做。 It is global for the framework.
它是框架的全球性。
DynamicImport-Package is similar but only for the bundle it is defined in and only for exported packages. DynamicImport-Package类似,但仅适用于定义的包,仅适用于导出的包。 If a package cannot be found in the normal bundle contents or Import-Package then a DynamicImport-Package specifies the patterns of packages that are allowed to be searched in the set of exported packages.
如果在普通包内容或Import-Package中找不到包,则DynamicImport-Package指定允许在导出包集中搜索的包的模式。 This idea is similar to the classpath, you've no idea what version you're going to get.
这个想法类似于类路径,你不知道你将得到什么版本。 Once a package is found, it is used forever.
找到包后,它将永久使用。 However, if it is not found every access will keep looking.
但是,如果没有找到,每次访问都会继续查看。 Ie you can install the package after the fact without restarting the bundle.
即您可以在事后安装软件包而无需重新启动软件包。
Packages imported via DynamicImport-Package are resolved every time a class from the package is needed. 每次需要包中的类时,都会解析通过DynamicImport-Package导入的包。 So if the package is not available due the resolving process, it will not fail.
因此,如果由于解决过程而导致包不可用,则不会失败。 By this way, ClassNotFoundExceptions may be thrown at runtime.
通过这种方式,可能会在运行时抛出ClassNotFoundExceptions。 (compare this to optional imports)
(将此与可选导入进行比较)
BootDelegation classes will be loaded from the bootdelegation class loader, which is the class loader which loads the OSGi framework 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 BootDelegation类将从bootdelegation类加载器加载,该类加载器是将OSGi框架加载到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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.