jdk/test/java/nio/file/WatchService/LotsOfCancels.java
changeset 39335 8dcd06ba5682
parent 26449 df1302c8e4bd
child 39726 0dbf4284a3f6
equal deleted inserted replaced
39334:e5e90a7fe509 39335:8dcd06ba5682
    48 
    48 
    49         // create a bunch of directories. Create two tasks for each directory,
    49         // create a bunch of directories. Create two tasks for each directory,
    50         // one to bash on cancel, the other to poll the events
    50         // one to bash on cancel, the other to poll the events
    51         ExecutorService pool = Executors.newCachedThreadPool();
    51         ExecutorService pool = Executors.newCachedThreadPool();
    52         try {
    52         try {
    53             Path top = Files.createTempDirectory("work");
    53             Path top = Files.createTempDirectory("LotsOfCancels");
    54             top.toFile().deleteOnExit();
    54             top.toFile().deleteOnExit();
    55             for (int i=1; i<=16; i++) {
    55             for (int i=1; i<=16; i++) {
    56                 Path dir = Files.createDirectory(top.resolve("dir-" + i));
    56                 Path dir = Files.createDirectory(top.resolve("dir-" + i));
    57                 WatchService watcher = FileSystems.getDefault().newWatchService();
    57                 WatchService watcher = FileSystems.getDefault().newWatchService();
    58                 pool.submit(() -> handle(dir, watcher));
    58                 pool.submit(() -> handle(dir, watcher));