I am using Java 7 WatchService to browse directories. I am constantly changing which directories I am browsing. I came across an exception:
java.io.IOException: Network BIOS command limit reached.
after 50 directories. I'm sure I call close () for every WatchService that I create before creating a new one.
Does anyone know the right way to issue WatchService so you don't run into this limit?
Thank,
Dave
, , , close() . , , , , , . , . WatchService - finally; .
close()
WatchService ws = ... try { // use it ... } finally { ws.close(); }
Java 7 " ".
try (WatchService ws = ...) { // use it ... }
WatchService , O/S, .
WatchService
, Java WatchService.
Javadoc, WatchService, () .
.register , , WatchKey. WatchKeys , , ConcurrentMap Path.
, cancel() WatchKey .
Path.Register
WatchKey