user5182503
user5182503

Reputation:

Osgi Bundle update and ResourceBundle

Lest's suppose we have two osgi bundles: bundleA and bundleB. In bundleB we have some texts.properties. So, in bundleA we do

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. And two questions :

  1. What happens to existing 'rb'? Must it work?
  2. If after new version of bundleB came we do the same code as above - will we see in rb new version of texts.properties? Or we need to do additional actions for this?

Upvotes: 0

Views: 87

Answers (1)

BJ Hargrave
BJ Hargrave

Reputation: 9384

Since bundleA has a reference to classFromBundleB, unless bundleA is refreshed, it will continue to maintain the classFromBundleB from the original bundleB. And since ResourceBundle maintains a cache, you will keep getting the same rb. So after updating bundleB, you will need to refresh the bundles which depend upon the classes from bundleB.

Upvotes: 0

Related Questions