wood burning stoves 2.0*
The moose likes Java in General and the fly likes Will the Resource Bundle object loads property file into memory? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Will the Resource Bundle object loads property file into memory?" Watch "Will the Resource Bundle object loads property file into memory?" New topic
Author

Will the Resource Bundle object loads property file into memory?

Mrutyunjay Hanchinal
Ranch Hand

Joined: Sep 26, 2001
Posts: 50
Hi All,
I have a basic doubt about the resource bundle object. I wanted to know if the creation of ResoureBundle object loads the entire property file or will it just create the pointer to file and every request to a key will do an I/O operation?
I think that the file gets loaded into memory(Please correct if I am wrong). In that case I feel that use of too many property files reduces the performance of the application.
I hope my concern is clear.
Waiting for all of your response.
Thanks,
Mrutyunjay
[ June 20, 2002: Message edited by: Mrutyunjay Hanchinal ]
Ashok Mash
Ranch Hand

Joined: Oct 13, 2000
Posts: 1936
I had the same doubt last year when I was working on Internationalisation of a CRM product.
Considering issues like frequent IO/file-reads (so not many small files) and efficient memory management (so no ONE single large file), I ended up suggesting with module level .properties files. (That was not the best option, I should say now.) That is one resource bundle per module of the product. That also helped us to manage module wise licenses efficiently.
Also another issue with a property file serving more than one class is, it becomes increasingly tedious for developers and will end up with duplicate keys!
Anyway, let the discussion continue...
Ashok.


[ flickr ]
Mrutyunjay Hanchinal
Ranch Hand

Joined: Sep 26, 2001
Posts: 50
Hi,
Thanks Ashok for your reply.
It appears from the reply of Ashok that the key value pairs in property file get loaded on to memory and hence it is not an I/O or File read operation instead it is burden on the memory.
Is this understanding correct?
Please suggest
Thanks,
Mrutyunjay
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8904

All the properties get loaded into memory. It is just like loading a class file.


Groovy
Dave Landers
Ranch Hand

Joined: Jul 24, 2002
Posts: 401
If you call ResourceBundle.getBundle("foo") several times, it caches what bundle it gave you and you get the same thing every time. So there is little extra cost for calling getBundle several times to retrieve the same bundle (you don't need to cache it yourself).
When ResourceBundle loads a properties file, the entire file is loaded when it is created using Properties.load().
Forums like this are a good place to get answers, but don't forget that the JDK comes with java source (in src.jar). So you can always check up on us by looking at the source yourself
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Will the Resource Bundle object loads property file into memory?
 
Similar Threads
Where should I place the property file in my webapps while using resource bundle
How to Modify Resource Bundle While your application is Running withou restarting Ser
Is it that use of property files hampers the prformance
resource bundle
Is resource bundle file used often?