This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to watch file directory tree w/o poling

 
Siegfried Heintze
Ranch Hand
Posts: 403
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How does the JBoss server detect when I drop a new WAR or EAR file into the drop directory? I noticed that JBoss (and I think other EJB containers) automagically expands a EAR/WAR file when it appears. Does it poll for new files?

I hope not. Windows has a function that allows C++ programmers to specify a call back function whenever there is a modification in the specified directory. I imagine linux/freebsd has this function too? I hope so.

Anyway, how can I write a java program that does not poll the file modification times to detect a new or modified file or directory? Can I do it with out JNI/C? I hope so.
Thanks,
Siegfried
 
Stephan van Hulst
Bartender
Pie
Posts: 4846
34
Chrome Netbeans IDE Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not without writing native code.

I believe Java 7 will provide this feature, but you'll have to wait for it.
 
Maneesh Godbole
Saloon Keeper
Posts: 10973
11
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
 
Rob Spoor
Sheriff
Pie
Posts: 20388
46
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stephan van Hulst wrote:I believe Java 7 will provide this feature, but you'll have to wait for it.

It will, with java.nio.file.WatchService, but that too may use polling internally if the file system doesn't support notifications.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic