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