Watching a Directory for Modifications in Java 7
Posted: 03/20/2012 Filed under: Java 7 New Features | Tags: Directory, Java 7, Notification, Service, Watch, Watcher 2 Comments »NIO 2.0 in Java 7 added support for directory change notification known as a watch service. It lets you receive notifications, when a directory is modified. There are six steps needed to set up a watch service.
- Creating a watch service
- Registering a directory with the watch service
- Retrieving a watch key from the watch service queue
- Processing the events that occurred on the registered directory
- Resetting the watch key after processing the events
- Closing the watch service
A watch service is an instance of the WatchService interface. You can create a watch service for the default file system as:
WatchService ws = FileSystems.getDefault().newWatchService();
Click here to read the full post in PDF format.
Please write some books on Servlet,JSP,Web Services and on MVC pattern..
It will be wonderful if you write fully on JAVA web technology.
I have benefited extensively from your three series books on Java.You are really man of your own word, what you have said in your Preface it holds true and been proved…
Great insights you have..
Hope to see following JAVA EDITIONS on Web Technology.
I concur!!!!