File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

Best way to Listen for file changes

Alejandro Ross

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,

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:

Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

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:
subject: Best way to Listen for file changes
It's not a secret anymore!