Monday 15 March 2010

Java ResourceBundle Performance -


I am using ResourceBundle and Locale to view property values. Quite simply, the code looks like this:

  public static string getPropertyValue (local locale, string resource name, string key) {ResourceBundle Resource = ResourceBundle.getBundle (resource name, locale); Return resource .getString (key); }  

My question is about performance, by accessing the asset files on the cashpath can the caching approach be quick or better implementation? I understand that the display of resource bundles is generally very good.

Attribute file (in this case) is less than 30 lines (i.e., add ~ 30 key / value).

I question performance because we can use the same approach on high-load pages, and the look-on-demand approach can be costly.

According to:

Resource bundle example getBundle < / Code> are made by factory methods are cached by default, and are returned in factory methods only. Resource bundle example is cached several times.

So you do not have to caching yourself. But if you need corrective control for caching behavior, then you can use surcharge and can be optimized.


No comments:

Post a Comment