Automatically reload file
I have a java program that reads in a properties file when it's first run. This properties file has rules that determine how many threads are created with listeners. However we are constantly changing the propties files, adding rules, etc and everytime we do we have to stop and restart the program. I need a way to have a thread spinoff and constantly check the properties file, if it's lastModifiedDate is later than the previous lastModifiedDate than it reloads it otherwise goes back to sleep.
I've looked around the net doing searches and can't seem to find anyone doing something similar - is it possible? I'm also thinking that this will present a new problem in that once it reloads the file it will create new threads for all of the rules that were previously created if they haven't been removed from the properties file. Is there a way around this too?
Log4j Does it. But you have to set a parameter first. The code is OS so you should be able to see how they do it.
Thanks, I had a look at the source and it was very useful.
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL