title: Java nio FileSystem Watcher locks directories. Deletion becomes impossible
body: <p>I'm using the new feature of Java7 for watching directories for changes (as it is described in the following tutorial: <a href="http://download.oracle.com/javase/tutorial/essential/io/notification.html" rel="nofollow">http://download.oracle.com/javase/tutorial/essential/io/notification.html</a> )</p>
  
  <p>The watching itself works (nearly) without problems.</p>
  
  <p>More or less I have two issues and I hope some of you have an idea how to handle it.</p>
  
  <ol>
  <li><p>After a folder is added to watch, the VM has access to it and it doesn't release it. This should not be such a big issue. But if you're creating a directory in another directory and in this one more. (e.g. you create in directory <code>c:\tmp\a</code> the directory <code>b</code> and in <code>b</code> the directory <code>c</code> (<code>c:\tmp\a\b\c</code>)) it is not possible to delete the directory <code>a</code>, because of the access of the VM to <code>b</code> and <code>c</code>. If you want to delete all of the folders (e.g., with your Windows Explorer) you have to delete <code>c</code> first, then <code>b</code> and then <code>a</code>. It's strange, but this way works (though is inconvenient)</p></li>
  <li><p>This issue seems to be a result of the first one.
  If many changes in <code>a</code> occur sometimes (more or less) I get an exception which tells me, the newly created folder is used by another process and it is not possible to access it. It's strange, because I think this should not matter to get a notification. And because it is not completely clear when exactly this exception is thrown.</p></li>
  </ol>
  
  <p>Do you have an idea how to make it possible to not have the lock or at least to let the user the ability to delete such a directory structure in the classical convenient way?</p>