Hi All, We are having some property files in our project. I don't want to do File I/O operation during each method call nor do I want to load the session with these values. So the property file loading was specified in the static block of the class and the values were retrieved. But the problem here is if the property file is modified we have to restart the application server. Is there any work-around for this or is there any other method of implementation? TIA, Nijeesh.
Don't store the properties values but go through the Properties object every time the value is needed. The lookup is quite quick. If you have access to the Properties object go through a static method, you can have that method check the datestamp on the file and reload if necessary. Bill
Joined: Oct 09, 2000
Hi William, Thanks for the response. Is it not heavy to check the lastModified time of the file every time(as it is also a File I/O operation) when you try to read from the Property object. Can we have a thread which runs during regular intervals and does this operation Please Clarify Thanks in Advance, Nijeesh.
Author and all-around good cowpoke
Joined: Mar 22, 2000
Checking the last modified date is certainly an IO operation but I don't think it is a particularly heavy one. Generally the operating system will have a cache of recently accessed disk data so it may not involve any real disk operation. As you suggest, if your traffic is heavy enough that this might make a differenc, then a separate Thread that looks every X seconds is easy enough to do. If your properties data is complex, consider using an XML DOM instead of a long properties file. Bill