aspose file tools*
The moose likes Java in General and the fly likes Best way to Listen for file changes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Best way to Listen for file changes" Watch "Best way to Listen for file changes" New topic
Author

Best way to Listen for file changes

Alejandro Ross
Greenhorn

Joined: Jun 13, 2006
Posts: 9
Hi everyone,

My question is as follows:
What is the best way to code a listener for file changes on a web application? Should it be a singleton? Should I create a listener? I hear that a standard listener with timer can cause memory issues with some applications.. I am using Quartz to run jobs. I want to fire a Quartz job that uses a file right after it has been modified.

Thanks in advance,


Alex
pascal betz
Ranch Hand

Joined: Jun 19, 2001
Posts: 547
why should it be a singleton ? (ok i am from the "Singletons are evil side" :-) )

have a look at this project:
http://jpoller.sourceforge.net/


pascal
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18662
    
    8

Would you ever want to have more than one listener waiting for a file change? It's possible, right? So no, not a singleton.
 
jQuery in Action, 2nd edition
 
subject: Best way to Listen for file changes