Apache Karaf 如何对要安装和启动的包进行排序? [英] How Apache Karaf sorts bundles to install and start?

查看:28
本文介绍了Apache Karaf 如何对要安装和启动的包进行排序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我定义了四个包:

bundle 1 : export package x version 1
bundle 2 : import package x ver [1,2] and export package y;y uses x    
bundle 3 : export package x version 2
bundle 4 : import package y and also import package x version 2

使用 apache felix(可分发二进制文件),我发现我应该手动强制不解析(或启动)bundle 1 然后在启动 bundle 3 之前 bundle 2(否则会出现使用约束问题,因为 bundle 2 将使用包x 版本 1 和捆绑包 4 中将出现包 x 版本 1 和版本 2 --> 使用约束冲突).
感谢这些帖子的作者:
http://njbartlett.name/2011/02/09/uses-constraints.html
http://blog.springsource.com/2008/10/20/understanding-the-osgi-uses-directive/
我不喜欢对我的包强加顺序,我需要将我所有的包复制到/bundle 目录中,然后框架的实例安装并启动它们.我注意到 Apache felix 按字母顺序对要安装的包进行排序(因此将安装包 1,然后首先启动).我尝试使用 Apache karaf,将我的包复制到/deploy 中,发现问题消失了,所以我的问题是:

Using apache felix (distribuable binary), I found that I should manually impose to not resolve (or start) the bundle 1 and then bundle 2 before starting the bundle 3 (otherwise a uses constraint problem appears because bundle 2 will use package x version 1 and in bundle 4 will appear package x version 1 and version 2 --> uses constraint violation).
Thanks to the authors of these posts:
http://njbartlett.name/2011/02/09/uses-constraints.html
http://blog.springsource.com/2008/10/20/understanding-the-osgi-uses-directive/
I don't like to impose order to my bundles, I need to copy all my bundles in the /bundle directory and then the instance of framework install and start them. I noticed that Apache felix sorts the bundles to be installed alphabetically (so bundle 1 will be installed and then started the first). I tried with Apache karaf, I copied my bundles into /deploy and I found that the problem disappears, so my question is:

Apache Karaf(或 felix 文件安装)是否应用策略来强加任何启动包的顺序以避免此类问题?

Does Apache Karaf, (or felix file install) apply a strategy to impose any order for starting bundles in order to avoid these kind of problems ?

推荐答案

您应该尝试将 Karaf 功能用于此类部署.您创建一个包含一个功能的功能文件,并将所有包添加到此功能中.然后 Karaf 将加载所有包并一次性解析和启动它们.因此,解析器应该能够正确解析您的所有包.

You should try to use a Karaf feature for this kind of deployment. You create a feature file with one feature in it and add all the bundles to this feature. Karaf will then load all the bundles and resolve and start them in one pass. So the resolver should bee able to correctly resolve all your bundles.

这篇关于Apache Karaf 如何对要安装和启动的包进行排序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆