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
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: 18126
    
    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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Best way to Listen for file changes
 
Similar Threads
Design/Architecture Question
regarding JDK1.7 release
listener to the folder changes in java application.
Automatically detect an update in a file
Tomcat Startup Problems