jdk/test/java/nio/file/WatchService/DeleteInterference.java
changeset 39335 8dcd06ba5682
parent 37727 f33cc7ee4a9c
child 39726 0dbf4284a3f6
equal deleted inserted replaced
39334:e5e90a7fe509 39335:8dcd06ba5682
    47      * Execute two tasks in a thread pool. One task loops on creating and
    47      * Execute two tasks in a thread pool. One task loops on creating and
    48      * closing a WatchService, the other task deletes and re-creates the
    48      * closing a WatchService, the other task deletes and re-creates the
    49      * directory.
    49      * directory.
    50      */
    50      */
    51     public static void main(String[] args) throws Exception {
    51     public static void main(String[] args) throws Exception {
    52         Path dir = Files.createTempDirectory("work");
    52         Path dir = Files.createTempDirectory("DeleteInterference");
    53         ExecutorService pool = Executors.newCachedThreadPool();
    53         ExecutorService pool = Executors.newCachedThreadPool();
    54         try {
    54         try {
    55             Future<?> task1 = pool.submit(() -> openAndCloseWatcher(dir));
    55             Future<?> task1 = pool.submit(() -> openAndCloseWatcher(dir));
    56             Future<?> task2 = pool.submit(() -> deleteAndRecreateDirectory(dir));
    56             Future<?> task2 = pool.submit(() -> deleteAndRecreateDirectory(dir));
    57             task1.get();
    57             task1.get();