aspose file tools*
The moose likes Java in General and the fly likes How to watch file directory tree w/o poling Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to watch file directory tree w/o poling" Watch "How to watch file directory tree w/o poling" New topic
Author

How to watch file directory tree w/o poling

Siegfried Heintze
Ranch Hand

Joined: Aug 11, 2000
Posts: 376
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

Joined: Sep 20, 2010
Posts: 3401
    
    9
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

Joined: Jul 26, 2007
Posts: 9995
    
    7

Check out JNotify


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19557
    
  16

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to watch file directory tree w/o poling
 
Similar Threads
Hot deployment issue in JBOSS??
Hot deployment problem
NoClassDefFoundError
Urgent: cannot find property file in war when packaged in ear
Jboss project development