[英]Osgi Bundle update and ResourceBundle
Lest's suppose we have two osgi bundles: bundleA and bundleB. 恐怕我们有两个osgi包:bundleA和bundleB。 In bundleB we have some
texts.properties
. 在bundleB中,我们有一些
texts.properties
。 So, in bundleA we do 因此,在bundleA中,我们这样做
ResourceBundle rb=
ResourceBundle.getBundle("com/foo/texts",locale, classFromBundleB.getClassLoader());
Now, we update bunldeB or totally remove it and install and start new version of bundleB that contains new version of texts.properties
. 现在,我们更新bunldeB或将其完全删除,并安装并启动包含新版本
texts.properties
新版本。 And two questions : 还有两个问题:
rb
new version of texts.properties
? rb
看到texts.properties
新版本吗? Or we need to do additional actions for this? Since bundleA has a reference to classFromBundleB, unless bundleA is refreshed, it will continue to maintain the classFromBundleB from the original bundleB. 由于bundleA对classFromBundleB的引用,除非刷新bundleA,否则它将继续从原始bundleB维护classFromBundleB。 And since ResourceBundle maintains a cache, you will keep getting the same rb.
而且由于ResourceBundle维护了一个缓存,您将获得相同的rb。 So after updating bundleB, you will need to refresh the bundles which depend upon the classes from bundleB.
因此,在更新bundleB之后,您将需要刷新依赖于bundleB中的类的bundle。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.