This implementation of DirectoryWatchService automatically waits for changes using a Thread Pool.
14151617181920212223
private static ThreadPoolDirectoryWatchService service = null; public synchronized DirectoryWatchService getService() throws IOException { if (this.service == null) { this.service = new ThreadPoolDirectoryWatchService(); } return this.service; }