In the article Internationalizing Servlets, the author states the current PropertyResourceBundle class is less efficient in a multithreaded world (like in J2EE/servlets) because it's based on Hashtable, that has synchronized calls.

Joe Sam Shirah



Whether the performance hit is worth addressing will depend directly on your site's volume and how often the ResourceBundle elements must be accessed. ListResourceBundle also uses a HashTable and so has the same considerations. It is unfortunate that synchronized methods are used in a read only operation. The article's author does provide an implementation that you are free to use. One downside there is that you end up with two copies of the data, which may or may not be a consideration. This aspect of ResourceBundle, along with the problem of refreshing ( see How can I reload ResourceBundles? ) certainly makes a rewrite of the class appealing.

About | Sitemap | Contact
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.