Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to watch file directory tree w/o poling

 
Siegfried Heintze
Ranch Hand
Posts: 417
  • 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
Posts: 6587
86
  • 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
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
 
Rob Spoor
Sheriff
Posts: 20822
68
Chrome Eclipse IDE Java Windows
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!