equal
deleted
inserted
replaced
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)); |