• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Runtime Monitoring of a file

Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have got a property file which I read once completely, create an object and make it as a cache service.
I need to monitor the property file(preferably a thread which watches it) continously such that when someone changes the contents in the file or add something, the program should fire an event about the change happened. On getting the trigger message I should refresh my cache object accordingly.
Can someone help me out in this issue?
Ranch Hand
Posts: 688
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Depends how soon do you want to reload the properties. For example: you can simply have a thread that compare file length or timestamp every 30 secs. Or you can do it in realtime, I never done it in realtime before, so maybe someone else can help you. One thing to remember, if your property changed, you have to figrue out how to propagate the changes without causing data integrity issue. You don't want a force-reload while the program is doing some kind data manipulation that could potential cause a corrupted data issue. My old program simply call a paused when finished current execution on all threads, write a snapshot (like checkpoints in database) then reload the data, and then restart the data.
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!