JNotify

I heard about JNotify via the debian-java list today, so I downloaded it and gave it a whirl. While some of the code is a bit yucky (direct calls to syscall? Who does that?), it works quite nicely. And, in true Java style, it makes an effort to be cross-platform; a Windows port is included.

I don’t have any immediate use for this in my own hacking; too bad.

Anyway… I read about inotify a bit more today and I was pleased to discover that a watch on a directory can also yield notification about changes to files in that directory. This means that contrary to what I had heard (irc being what it is), this feature would definitely be usable for speeding up common operations in monotone. In fact, it’s a wonder that nobody has done this already.

Another area worth exploring is changing make to use inotify, to avoid all those pesky stats.

4 Comments

  • It only notifies about changes to files _directly_ in that directory, though; not all files recursively under it. You need to register one watch per directory, and this may or may not be possible, depending on the size of your tree and the setting of inotify’s “maximum registered watches per user” knob.

    That said, it’d still be cool.

  • Yeah, true.
    Luckily the default for max_user_watches is 8192 — well above the 1836 needed to watch the GCC source tree.
    I didn’t look at the linux kernel or mozilla; I wonder whether either of those hits this default.

  • Hi I was looking for Jnotify tutorial for how to use Jnotify and found ur post can you please help me with that?
    As m a naive I just know that i need to download jnotify and add it to library in netbeans.i want to use Jnotify for myproject where whenevr a new file comes in afolder that should notify then a java program will run to get data from tht XML file and insert into sqlserver database..can you please guide me

  • It has been many years since I looked at jnotify.
    All I can suggest is that you find the maintainers and ask them about it.

Join the Discussion

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This site uses Akismet to reduce spam. Learn how your comment data is processed.