I have a custom database-backed ResourceBundle
that needs to be reloaded sometimes.
I do not want to use ResourceBundle.clearCache()
because it reloads all the bundles.
Is it possible to reload just one bundle?
What you want to do is part of the Java API since 1.6. Start by getting the handle to the bundle you want to reload:
ResourceBundle bundle = ResourceBundle.getBundle("MyResources", new Locale("fr", "CH"),
ResourceBundle.Control.getControl(FORMAT_PROPERTIES));
You can set the time to live for the bundle and allow the loader to reload it for you. You can read all about this in the Java API docs.