DeletionService { public void delete(Path subDir, Path... baseDirs) { if (debugDelay != -1) { sched.schedule(new FileDeletion(subDir, baseDirs), debugDelay, TimeUnit.SECONDS); } } DeletionService(int defaultThreads, int debugDelay); void delete(Path subDir, Path... baseDirs); void stop();  }
@Test public final void testTemporalDirectory() throws IOException, InterruptedException { int delay = 1; deletionService = new DeletionService(1, delay); FileSystem fs = FileSystem.getLocal(new Configuration()); Path tempPath = CommonTestingUtil.getTestDir(); assertTrue(fs.exists(tempPath)); deletionService.delete(tempPath); assertTrue(fs.exists(tempPath)); Thread.sleep(delay * 2 * 1000); assertFalse(fs.exists(tempPath)); }