cleanup resources
This commit is contained in:
parent
8bf825d046
commit
c9a754f0e4
|
@ -10,6 +10,7 @@ import java.nio.file.WatchKey;
|
||||||
import java.nio.file.WatchService;
|
import java.nio.file.WatchService;
|
||||||
|
|
||||||
public class DirectoryWatcherExample {
|
public class DirectoryWatcherExample {
|
||||||
|
|
||||||
public static void main(String[] args) throws IOException, InterruptedException {
|
public static void main(String[] args) throws IOException, InterruptedException {
|
||||||
WatchService watchService = FileSystems.getDefault().newWatchService();
|
WatchService watchService = FileSystems.getDefault().newWatchService();
|
||||||
Path path = Paths.get(System.getProperty("user.home"));
|
Path path = Paths.get(System.getProperty("user.home"));
|
||||||
|
@ -21,5 +22,8 @@ public class DirectoryWatcherExample {
|
||||||
}
|
}
|
||||||
key.reset();
|
key.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
watchService.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue