jdk/test/java/nio/file/WatchService/DeleteInterference.java
changeset 39726 0dbf4284a3f6
parent 39335 8dcd06ba5682
child 40123 673d89604418
--- a/jdk/test/java/nio/file/WatchService/DeleteInterference.java	Fri Jul 15 14:04:09 2016 -0700
+++ b/jdk/test/java/nio/file/WatchService/DeleteInterference.java	Fri Jul 15 17:49:42 2016 -0700
@@ -32,6 +32,7 @@
 import java.nio.file.FileSystems;
 import java.nio.file.Files;
 import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.nio.file.WatchService;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
@@ -49,7 +50,8 @@
      * directory.
      */
     public static void main(String[] args) throws Exception {
-        Path dir = Files.createTempDirectory("DeleteInterference");
+        Path testDir = Paths.get(System.getProperty("test.dir", "."));
+        Path dir = Files.createTempDirectory(testDir, "DeleteInterference");
         ExecutorService pool = Executors.newCachedThreadPool();
         try {
             Future<?> task1 = pool.submit(() -> openAndCloseWatcher(dir));
@@ -58,7 +60,6 @@
             task2.get();
         } finally {
             pool.shutdown();
-            deleteFileTree(dir);
         }
     }