Java 7 listen for file/directory change

Today I’ve started to experiment with some new features we’ll get in Java 7. First is filesystem WatchService which allows us to listen to changes in some directory without any pooling. Looks really great. You just register to be notified about change and wait to get your notifications. Best of it you can assign as much listeners as you like and even from different threads with no code changes, it all is thread save. Here’s what I’ve done to get notified about files being modified/removed/added to my very important TEMP directory:
Continue reading…

Advertisements
%d bloggers like this: