4

In Java, if you use the WatchService frameworks to watch the disk for changes, it locks the parents of watched directories, preventing deletion, renaming, etc.

This is an undesirable behavior for my program. Is it possible to either tell the WatchService to not lock, or is there an alternative API which watches the disk but does not lock any folders?

Mikhail Kholodkov
  • 23,642
  • 17
  • 61
  • 78
Grumblesaurus
  • 3,021
  • 3
  • 31
  • 61
  • 1
    As per an older [thread](https://stackoverflow.com/a/6265860/5623232), this is a [known bug](https://bugs.java.com/bugdatabase/view_bug.do?bug_id=6972833), and has been marked as **Won't Fix**. Try the workaround mentioned. – NPras Jul 02 '19 at 08:29
  • Possible duplicate of [Java7 WatchService - Access Denied error trying to delete recursively watched nested directories (Windows only)](https://stackoverflow.com/questions/6255463/java7-watchservice-access-denied-error-trying-to-delete-recursively-watched-ne) – NPras Jul 02 '19 at 08:30

0 Answers0